1 module raylib; 2 3 import core.stdc.stdlib; 4 import core.stdc.stdarg; 5 import core.stdc.config; 6 7 extern (C) @nogc nothrow: 8 9 /// Raylib's palette 10 enum Colors 11 { 12 LIGHTGRAY = Color(200, 200, 200, 255), 13 GRAY = Color(130, 130, 130, 255), 14 DARKGRAY = Color(80, 80, 80, 255), 15 YELLOW = Color(253, 249, 0, 255), 16 GOLD = Color(255, 203, 0, 255), 17 ORANGE = Color(255, 161, 0, 255), 18 PINK = Color(255, 109, 194, 255), 19 RED = Color(230, 41, 55, 255), 20 MAROON = Color(190, 33, 55, 255), 21 GREEN = Color(0, 228, 48, 255), 22 LIME = Color(0, 158, 47, 255), 23 DARKGREEN = Color(0, 117, 44, 255), 24 SKYBLUE = Color(102, 191, 255, 255), 25 BLUE = Color(0, 121, 241, 255), 26 DARKBLUE = Color(0, 82, 172, 255), 27 PURPLE = Color(200, 122, 255, 255), 28 VIOLET = Color(135, 60, 190, 255), 29 DARKPURPLE = Color(112, 31, 126, 255), 30 BEIGE = Color(211, 176, 131, 255), 31 BROWN = Color(127, 106, 79, 255), 32 DARKBROWN = Color(76, 63, 47, 255), 33 WHITE = Color(255, 255, 255, 255), 34 BLACK = Color(0, 0, 0, 255), 35 BLANK = Color(0, 0, 0, 0), 36 MAGENTA = Color(255, 37 0, 255, 255), 38 RAYWHITE = Color(245, 245, 245, 255), 39 } 40 41 //---------------------------------------------------------------------------------- 42 // Structures Definition 43 //---------------------------------------------------------------------------------- 44 45 /// Vector2, 2 components 46 struct Vector2 47 { 48 float x; /// Vector x component 49 float y; /// Vector y component 50 } 51 52 /// Vector3, 3 components 53 struct Vector3 54 { 55 float x; /// Vector x component 56 float y; /// Vector y component 57 float z; /// Vector z component 58 } 59 60 /// Vector4, 4 components 61 struct Vector4 62 { 63 float x; /// Vector x component 64 float y; /// Vector y component 65 float z; /// Vector z component 66 float w; /// Vector w component 67 } 68 69 /// Quaternion, 4 components (Vector4 alias) 70 alias Quaternion = Vector4; 71 72 /// Matrix, 4x4 components, column major, OpenGL style, right handed 73 struct Matrix 74 { 75 /// Matrix first row (4 components) 76 float m0, m4, m8, m12; 77 /// Matrix second row (4 components) 78 float m1, m5, m9, m13; 79 /// Matrix third row (4 components) 80 float m2, m6, m10, m14; 81 /// Matrix fourth row (4 components) 82 float m3, m7, m11, m15; 83 } 84 85 /// Color, 4 components, R8G8B8A8 (32bit) 86 struct Color 87 { 88 ubyte r; /// Color red value 89 ubyte g; /// Color green value 90 ubyte b; /// Color blue value 91 ubyte a; /// Color alpha value 92 } 93 94 /// Rectangle, 4 components 95 struct Rectangle 96 { 97 float x; /// Rectangle top-left corner position x 98 float y; /// Rectangle top-left corner position y 99 float width; /// Rectangle width 100 float height; /// Rectangle height 101 } 102 103 /// Image, pixel data stored in CPU memory (RAM) 104 struct Image 105 { 106 void* data; /// Image raw data 107 int width; /// Image base width 108 int height; /// Image base height 109 int mipmaps; /// Mipmap levels, 1 by default 110 int format; /// Data format (PixelFormat type) 111 } 112 113 /// Texture, tex data stored in GPU memory (VRAM) 114 struct Texture 115 { 116 uint id; /// OpenGL texture id 117 int width; /// Texture base width 118 int height; /// Texture base height 119 int mipmaps; /// Mipmap levels, 1 by default 120 int format; /// Data format (PixelFormat type) 121 } 122 123 /// Texture2D, same as Texture 124 alias Texture2D = Texture; 125 126 /// TextureCubemap, same as Texture 127 alias TextureCubemap = Texture; 128 129 /// RenderTexture, fbo for texture rendering 130 struct RenderTexture 131 { 132 uint id; /// OpenGL framebuffer object id 133 Texture texture; /// Color buffer attachment texture 134 Texture depth; /// Depth buffer attachment texture 135 } 136 137 /// RenderTexture2D, same as RenderTexture 138 alias RenderTexture2D = RenderTexture; 139 140 /// NPatchInfo, n-patch layout info 141 struct NPatchInfo 142 { 143 Rectangle source; /// Texture source rectangle 144 int left; /// Left border offset 145 int top; /// Top border offset 146 int right; /// Right border offset 147 int bottom; /// Bottom border offset 148 int layout; /// Layout of the n-patch: 3x3, 1x3 or 3x1 149 } 150 151 /// GlyphInfo, font characters glyphs info 152 struct GlyphInfo 153 { 154 int value; /// Character value (Unicode) 155 int offsetX; /// Character offset X when drawing 156 int offsetY; /// Character offset Y when drawing 157 int advanceX; /// Character advance position X 158 Image image; /// Character image data 159 } 160 161 /// Font, font texture and GlyphInfo array data 162 struct Font 163 { 164 int baseSize; /// Base size (default chars height) 165 int glyphCount; /// Number of glyph characters 166 int glyphPadding; /// Padding around the glyph characters 167 Texture2D texture; /// Texture atlas containing the glyphs 168 Rectangle* recs; /// Rectangles in texture for the glyphs 169 GlyphInfo* glyphs; /// Glyphs info data 170 } 171 172 /// Camera, defines position/orientation in 3d space 173 struct Camera3D 174 { 175 Vector3 position; /// Camera position 176 Vector3 target; /// Camera target it looks-at 177 Vector3 up; /// Camera up vector (rotation over its axis) 178 float fovy; /// Camera field-of-view apperture in Y (degrees) in perspective, used as near plane width in orthographic 179 int projection; /// Camera projection: CAMERA_PERSPECTIVE or CAMERA_ORTHOGRAPHIC 180 } 181 182 alias Camera = Camera3D; /// Camera type fallback, defaults to Camera3D 183 184 /// Camera2D, defines position/orientation in 2d space 185 struct Camera2D 186 { 187 Vector2 offset; /// Camera offset (displacement from target) 188 Vector2 target; /// Camera target (rotation and zoom origin) 189 float rotation; /// Camera rotation in degrees 190 float zoom; /// Camera zoom (scaling), should be 1.0f by default 191 } 192 193 /// Mesh, vertex data and vao/vbo 194 struct Mesh 195 { 196 int vertexCount; /// Number of vertices stored in arrays 197 int triangleCount; /// Number of triangles stored (indexed or not) 198 199 /// Vertex attributes data 200 float* vertices; /// Vertex position (XYZ - 3 components per vertex) (shader-location = 0) 201 float* texcoords; /// Vertex texture coordinates (UV - 2 components per vertex) (shader-location = 1) 202 float* texcoords2; /// Vertex second texture coordinates (useful for lightmaps) (shader-location = 5) 203 float* normals; /// Vertex normals (XYZ - 3 components per vertex) (shader-location = 2) 204 float* tangents; /// Vertex tangents (XYZW - 4 components per vertex) (shader-location = 4) 205 ubyte* colors; /// Vertex colors (RGBA - 4 components per vertex) (shader-location = 3) 206 ushort* indices; /// Vertex indices (in case vertex data comes indexed) 207 208 /// Animation vertex data 209 float* animVertices; /// Animated vertex positions (after bones transformations) 210 float* animNormals; /// Animated normals (after bones transformations) 211 int* boneIds; /// Vertex bone ids, up to 4 bones influence by vertex (skinning) 212 float* boneWeights; /// Vertex bone weight, up to 4 bones influence by vertex (skinning) 213 214 /// OpenGL identifiers 215 uint vaoId; /// OpenGL Vertex Array Object id 216 uint* vboId; /// OpenGL Vertex Buffer Objects id (default vertex data) 217 } 218 219 /// Shader 220 struct Shader 221 { 222 uint id; /// Shader program id 223 int* locs; /// Shader locations array (RL_MAX_SHADER_LOCATIONS) 224 } 225 226 /// MaterialMap 227 struct MaterialMap 228 { 229 Texture2D texture; /// Material map texture 230 Color color; /// Material map color 231 float value; /// Material map value 232 } 233 234 /// Material, includes shader and maps 235 struct Material 236 { 237 Shader shader; /// Material shader 238 MaterialMap* maps; /// Material maps array (MAX_MATERIAL_MAPS) 239 float[4] params; /// Material generic parameters (if required) 240 } 241 242 /// Transform, vectex transformation data 243 struct Transform 244 { 245 Vector3 translation; /// Translation 246 Quaternion rotation; /// Rotation 247 Vector3 scale; /// Scale 248 } 249 250 /// Bone, skeletal animation bone 251 struct BoneInfo 252 { 253 char[32] name; /// Bone name 254 int parent; /// Bone parent 255 } 256 257 /// Model, meshes, materials and animation data 258 struct Model 259 { 260 Matrix transform; /// Local transform matrix 261 262 int meshCount; /// Number of meshes 263 int materialCount; /// Number of materials 264 Mesh* meshes; /// Meshes array 265 Material* materials; /// Materials array 266 int* meshMaterial; /// Mesh material number 267 268 /// Animation data 269 int boneCount; /// Number of bones 270 BoneInfo* bones; /// Bones information (skeleton) 271 Transform* bindPose; /// Bones base transformation (pose) 272 } 273 274 /// ModelAnimation 275 struct ModelAnimation 276 { 277 int boneCount; /// Number of bones 278 int frameCount; /// Number of animation frames 279 BoneInfo* bones; /// Bones information (skeleton) 280 Transform** framePoses; /// Poses array by frame 281 } 282 283 /// Ray, ray for raycasting 284 struct Ray 285 { 286 Vector3 position; /// Ray position (origin) 287 Vector3 direction; /// Ray direction 288 } 289 290 /// RayCollision, ray hit information 291 struct RayCollision 292 { 293 bool hit; /// Did the ray hit something? 294 float distance; /// Distance to nearest hit 295 Vector3 point; /// Point of nearest hit 296 Vector3 normal; /// Surface normal of hit 297 } 298 299 /// BoundingBox 300 struct BoundingBox 301 { 302 Vector3 min; /// Minimum vertex box-corner 303 Vector3 max; /// Maximum vertex box-corner 304 } 305 306 /// Wave, audio wave data 307 struct Wave 308 { 309 uint frameCount; /// Total number of frames (considering channels) 310 uint sampleRate; /// Frequency (samples per second) 311 uint sampleSize; /// Bit depth (bits per sample): 8, 16, 32 (24 not supported) 312 uint channels; /// Number of channels (1-mono, 2-stereo, ...) 313 void* data; /// Buffer data pointer 314 } 315 316 private struct rAudioBuffer; 317 318 /// AudioStream, custom audio stream 319 struct AudioStream 320 { 321 rAudioBuffer* buffer; /// Pointer to internal data used by the audio system 322 323 uint sampleRate; /// Frequency (samples per second) 324 uint sampleSize; /// Bit depth (bits per sample): 8, 16, 32 (24 not supported) 325 uint channels; /// Number of channels (1-mono, 2-stereo, ...) 326 } 327 328 /// Sound 329 struct Sound 330 { 331 AudioStream stream; /// Audio stream 332 uint frameCount; /// Total number of frames (considering channels) 333 } 334 335 /// Music, audio stream, anything longer than ~10 seconds should be streamed 336 struct Music 337 { 338 AudioStream stream; /// Audio stream 339 uint frameCount; /// Total number of frames (considering channels) 340 bool looping; /// Music looping enable 341 342 int ctxType; /// Type of music context (audio filetype) 343 void* ctxData; /// Audio context data, depends on type 344 } 345 346 /// VrDeviceInfo, Head-Mounted-Display device parameters 347 struct VrDeviceInfo 348 { 349 int hResolution; /// Horizontal resolution in pixels 350 int vResolution; /// Vertical resolution in pixels 351 float hScreenSize; /// Horizontal size in meters 352 float vScreenSize; /// Vertical size in meters 353 float vScreenCenter; /// Screen center in meters 354 float eyeToScreenDistance; /// Distance between eye and display in meters 355 float lensSeparationDistance; /// Lens separation distance in meters 356 float interpupillaryDistance; /// IPD (distance between pupils) in meters 357 float[4] lensDistortionValues; /// Lens distortion constant parameters 358 float[4] chromaAbCorrection; /// Chromatic aberration correction parameters 359 } 360 361 /// VrStereoConfig, VR stereo rendering configuration for simulator 362 struct VrStereoConfig 363 { 364 Matrix[2] projection; /// VR projection matrices (per eye) 365 Matrix[2] viewOffset; /// VR view offset matrices (per eye) 366 float[2] leftLensCenter; /// VR left lens center 367 float[2] rightLensCenter; /// VR right lens center 368 float[2] leftScreenCenter; /// VR left screen center 369 float[2] rightScreenCenter; /// VR right screen center 370 float[2] scale; /// VR distortion scale 371 float[2] scaleIn; /// VR distortion scale in 372 } 373 374 //---------------------------------------------------------------------------------- 375 // Enumerators Definition 376 //---------------------------------------------------------------------------------- 377 /// System/Window config flags 378 /// NOTE: Every bit registers one state (use it with bit masks). By default all flags are set to 0 379 enum ConfigFlags 380 { 381 FLAG_VSYNC_HINT = 0x00000040, /// Set to try enabling V-Sync on GPU 382 FLAG_FULLSCREEN_MODE = 0x00000002, /// Set to run program in fullscreen 383 FLAG_WINDOW_RESIZABLE = 0x00000004, /// Set to allow resizable window 384 FLAG_WINDOW_UNDECORATED = 0x00000008, /// Set to disable window decoration (frame and buttons) 385 FLAG_WINDOW_HIDDEN = 0x00000080, /// Set to hide window 386 FLAG_WINDOW_MINIMIZED = 0x00000200, /// Set to minimize window (iconify) 387 FLAG_WINDOW_MAXIMIZED = 0x00000400, /// Set to maximize window (expanded to monitor) 388 FLAG_WINDOW_UNFOCUSED = 0x00000800, /// Set to window non focused 389 FLAG_WINDOW_TOPMOST = 0x00001000, /// Set to window always on top 390 FLAG_WINDOW_ALWAYS_RUN = 0x00000100, /// Set to allow windows running while minimized 391 FLAG_WINDOW_TRANSPARENT = 0x00000010, /// Set to allow transparent framebuffer 392 FLAG_WINDOW_HIGHDPI = 0x00002000, /// Set to support HighDPI 393 FLAG_MSAA_4X_HINT = 0x00000020, /// Set to try enabling MSAA 4X 394 FLAG_INTERLACED_HINT = 0x00010000 /// Set to try enabling interlaced video format (for V3D) 395 } 396 397 /// Trace log level 398 /// NOTE: Organized by priority level 399 enum TraceLogLevel 400 { 401 LOG_ALL = 0, /// Display all logs 402 LOG_TRACE, /// Trace logging, intended for internal use only 403 LOG_DEBUG, /// Debug logging, used for internal debugging, it should be disabled on release builds 404 LOG_INFO, /// Info logging, used for program execution info 405 LOG_WARNING, /// Warning logging, used on recoverable failures 406 LOG_ERROR, /// Error logging, used on unrecoverable failures 407 LOG_FATAL, /// Fatal logging, used to abort program: exit(EXIT_FAILURE) 408 LOG_NONE /// Disable logging 409 } 410 411 /// Keyboard keys (US keyboard layout) 412 /// NOTE: Use GetKeyPressed() to allow redefining required keys for alternative layouts 413 enum KeyboardKey 414 { 415 KEY_NULL = 0, /// Key: NULL, used for no key pressed 416 /// Alphanumeric keys 417 KEY_APOSTROPHE = 39, /// Key: ' 418 KEY_COMMA = 44, /// Key: , 419 KEY_MINUS = 45, /// Key: - 420 KEY_PERIOD = 46, /// Key: . 421 KEY_SLASH = 47, /// Key: / 422 KEY_ZERO = 48, /// Key: 0 423 KEY_ONE = 49, /// Key: 1 424 KEY_TWO = 50, /// Key: 2 425 KEY_THREE = 51, /// Key: 3 426 KEY_FOUR = 52, /// Key: 4 427 KEY_FIVE = 53, /// Key: 5 428 KEY_SIX = 54, /// Key: 6 429 KEY_SEVEN = 55, /// Key: 7 430 KEY_EIGHT = 56, /// Key: 8 431 KEY_NINE = 57, /// Key: 9 432 KEY_SEMICOLON = 59, /// Key: ; 433 KEY_EQUAL = 61, /// Key: = 434 KEY_A = 65, /// Key: A | a 435 KEY_B = 66, /// Key: B | b 436 KEY_C = 67, /// Key: C | c 437 KEY_D = 68, /// Key: D | d 438 KEY_E = 69, /// Key: E | e 439 KEY_F = 70, /// Key: F | f 440 KEY_G = 71, /// Key: G | g 441 KEY_H = 72, /// Key: H | h 442 KEY_I = 73, /// Key: I | i 443 KEY_J = 74, /// Key: J | j 444 KEY_K = 75, /// Key: K | k 445 KEY_L = 76, /// Key: L | l 446 KEY_M = 77, /// Key: M | m 447 KEY_N = 78, /// Key: N | n 448 KEY_O = 79, /// Key: O | o 449 KEY_P = 80, /// Key: P | p 450 KEY_Q = 81, /// Key: Q | q 451 KEY_R = 82, /// Key: R | r 452 KEY_S = 83, /// Key: S | s 453 KEY_T = 84, /// Key: T | t 454 KEY_U = 85, /// Key: U | u 455 KEY_V = 86, /// Key: V | v 456 KEY_W = 87, /// Key: W | w 457 KEY_X = 88, /// Key: X | x 458 KEY_Y = 89, /// Key: Y | y 459 KEY_Z = 90, /// Key: Z | z 460 KEY_LEFT_BRACKET = 91, /// Key: [ 461 KEY_BACKSLASH = 92, /// Key: '\' 462 KEY_RIGHT_BRACKET = 93, /// Key: ] 463 KEY_GRAVE = 96, /// Key: ` 464 /// Function keys 465 KEY_SPACE = 32, /// Key: Space 466 KEY_ESCAPE = 256, /// Key: Esc 467 KEY_ENTER = 257, /// Key: Enter 468 KEY_TAB = 258, /// Key: Tab 469 KEY_BACKSPACE = 259, /// Key: Backspace 470 KEY_INSERT = 260, /// Key: Ins 471 KEY_DELETE = 261, /// Key: Del 472 KEY_RIGHT = 262, /// Key: Cursor right 473 KEY_LEFT = 263, /// Key: Cursor left 474 KEY_DOWN = 264, /// Key: Cursor down 475 KEY_UP = 265, /// Key: Cursor up 476 KEY_PAGE_UP = 266, /// Key: Page up 477 KEY_PAGE_DOWN = 267, /// Key: Page down 478 KEY_HOME = 268, /// Key: Home 479 KEY_END = 269, /// Key: End 480 KEY_CAPS_LOCK = 280, /// Key: Caps lock 481 KEY_SCROLL_LOCK = 281, /// Key: Scroll down 482 KEY_NUM_LOCK = 282, /// Key: Num lock 483 KEY_PRINT_SCREEN = 283, /// Key: Print screen 484 KEY_PAUSE = 284, /// Key: Pause 485 KEY_F1 = 290, /// Key: F1 486 KEY_F2 = 291, /// Key: F2 487 KEY_F3 = 292, /// Key: F3 488 KEY_F4 = 293, /// Key: F4 489 KEY_F5 = 294, /// Key: F5 490 KEY_F6 = 295, /// Key: F6 491 KEY_F7 = 296, /// Key: F7 492 KEY_F8 = 297, /// Key: F8 493 KEY_F9 = 298, /// Key: F9 494 KEY_F10 = 299, /// Key: F10 495 KEY_F11 = 300, /// Key: F11 496 KEY_F12 = 301, /// Key: F12 497 KEY_LEFT_SHIFT = 340, /// Key: Shift left 498 KEY_LEFT_CONTROL = 341, /// Key: Control left 499 KEY_LEFT_ALT = 342, /// Key: Alt left 500 KEY_LEFT_SUPER = 343, /// Key: Super left 501 KEY_RIGHT_SHIFT = 344, /// Key: Shift right 502 KEY_RIGHT_CONTROL = 345, /// Key: Control right 503 KEY_RIGHT_ALT = 346, /// Key: Alt right 504 KEY_RIGHT_SUPER = 347, /// Key: Super right 505 KEY_KB_MENU = 348, /// Key: KB menu 506 /// Keypad keys 507 KEY_KP_0 = 320, /// Key: Keypad 0 508 KEY_KP_1 = 321, /// Key: Keypad 1 509 KEY_KP_2 = 322, /// Key: Keypad 2 510 KEY_KP_3 = 323, /// Key: Keypad 3 511 KEY_KP_4 = 324, /// Key: Keypad 4 512 KEY_KP_5 = 325, /// Key: Keypad 5 513 KEY_KP_6 = 326, /// Key: Keypad 6 514 KEY_KP_7 = 327, /// Key: Keypad 7 515 KEY_KP_8 = 328, /// Key: Keypad 8 516 KEY_KP_9 = 329, /// Key: Keypad 9 517 KEY_KP_DECIMAL = 330, /// Key: Keypad . 518 KEY_KP_DIVIDE = 331, /// Key: Keypad / 519 KEY_KP_MULTIPLY = 332, /// Key: Keypad * 520 KEY_KP_SUBTRACT = 333, /// Key: Keypad - 521 KEY_KP_ADD = 334, /// Key: Keypad + 522 KEY_KP_ENTER = 335, /// Key: Keypad Enter 523 KEY_KP_EQUAL = 336, /// Key: Keypad = 524 /// Android key buttons 525 KEY_BACK = 4, /// Key: Android back button 526 KEY_MENU = 82, /// Key: Android menu button 527 KEY_VOLUME_UP = 24, /// Key: Android volume up button 528 KEY_VOLUME_DOWN = 25 /// Key: Android volume down button 529 } 530 531 /// Mouse buttons 532 enum MouseButton 533 { 534 MOUSE_BUTTON_LEFT = 0, /// Mouse button left 535 MOUSE_BUTTON_RIGHT = 1, /// Mouse button right 536 MOUSE_BUTTON_MIDDLE = 2, /// Mouse button middle (pressed wheel) 537 MOUSE_BUTTON_SIDE = 3, /// Mouse button side (advanced mouse device) 538 MOUSE_BUTTON_EXTRA = 4, /// Mouse button extra (advanced mouse device) 539 MOUSE_BUTTON_FORWARD = 5, /// Mouse button fordward (advanced mouse device) 540 MOUSE_BUTTON_BACK = 6, /// Mouse button back (advanced mouse device) 541 } 542 543 // Add backwards compatibility support for deprecated names 544 alias MOUSE_LEFT_BUTTON = MouseButton.MOUSE_BUTTON_LEFT; 545 alias MOUSE_RIGHT_BUTTON = MouseButton.MOUSE_BUTTON_RIGHT; 546 alias MOUSE_MIDDLE_BUTTON = MouseButton.MOUSE_BUTTON_MIDDLE; 547 548 /// Mouse cursor 549 enum MouseCursor 550 { 551 MOUSE_CURSOR_DEFAULT = 0, /// Default pointer shape 552 MOUSE_CURSOR_ARROW = 1, /// Arrow shape 553 MOUSE_CURSOR_IBEAM = 2, /// Text writing cursor shape 554 MOUSE_CURSOR_CROSSHAIR = 3, /// Cross shape 555 MOUSE_CURSOR_POINTING_HAND = 4, /// Pointing hand cursor 556 MOUSE_CURSOR_RESIZE_EW = 5, /// Horizontal resize/move arrow shape 557 MOUSE_CURSOR_RESIZE_NS = 6, /// Vertical resize/move arrow shape 558 MOUSE_CURSOR_RESIZE_NWSE = 7, /// Top-left to bottom-right diagonal resize/move arrow shape 559 MOUSE_CURSOR_RESIZE_NESW = 8, /// The top-right to bottom-left diagonal resize/move arrow shape 560 MOUSE_CURSOR_RESIZE_ALL = 9, /// The omni-directional resize/move cursor shape 561 MOUSE_CURSOR_NOT_ALLOWED = 10 /// The operation-not-allowed shape 562 } 563 564 /// Gamepad buttons 565 enum GamepadButton 566 { 567 GAMEPAD_BUTTON_UNKNOWN = 0, /// Unknown button, just for error checking 568 GAMEPAD_BUTTON_LEFT_FACE_UP, /// Gamepad left DPAD up button 569 GAMEPAD_BUTTON_LEFT_FACE_RIGHT, /// Gamepad left DPAD right button 570 GAMEPAD_BUTTON_LEFT_FACE_DOWN, /// Gamepad left DPAD down button 571 GAMEPAD_BUTTON_LEFT_FACE_LEFT, /// Gamepad left DPAD left button 572 GAMEPAD_BUTTON_RIGHT_FACE_UP, /// Gamepad right button up (i.e. PS3: Triangle, Xbox: Y) 573 GAMEPAD_BUTTON_RIGHT_FACE_RIGHT, /// Gamepad right button right (i.e. PS3: Square, Xbox: X) 574 GAMEPAD_BUTTON_RIGHT_FACE_DOWN, /// Gamepad right button down (i.e. PS3: Cross, Xbox: A) 575 GAMEPAD_BUTTON_RIGHT_FACE_LEFT, /// Gamepad right button left (i.e. PS3: Circle, Xbox: B) 576 GAMEPAD_BUTTON_LEFT_TRIGGER_1, /// Gamepad top/back trigger left (first), it could be a trailing button 577 GAMEPAD_BUTTON_LEFT_TRIGGER_2, /// Gamepad top/back trigger left (second), it could be a trailing button 578 GAMEPAD_BUTTON_RIGHT_TRIGGER_1, /// Gamepad top/back trigger right (one), it could be a trailing button 579 GAMEPAD_BUTTON_RIGHT_TRIGGER_2, /// Gamepad top/back trigger right (second), it could be a trailing button 580 GAMEPAD_BUTTON_MIDDLE_LEFT, /// Gamepad center buttons, left one (i.e. PS3: Select) 581 GAMEPAD_BUTTON_MIDDLE, /// Gamepad center buttons, middle one (i.e. PS3: PS, Xbox: XBOX) 582 GAMEPAD_BUTTON_MIDDLE_RIGHT, /// Gamepad center buttons, right one (i.e. PS3: Start) 583 GAMEPAD_BUTTON_LEFT_THUMB, /// Gamepad joystick pressed button left 584 GAMEPAD_BUTTON_RIGHT_THUMB /// Gamepad joystick pressed button right 585 } 586 587 /// Gamepad axis 588 enum GamepadAxis 589 { 590 GAMEPAD_AXIS_LEFT_X = 0, /// Gamepad left stick X axis 591 GAMEPAD_AXIS_LEFT_Y = 1, /// Gamepad left stick Y axis 592 GAMEPAD_AXIS_RIGHT_X = 2, /// Gamepad right stick X axis 593 GAMEPAD_AXIS_RIGHT_Y = 3, /// Gamepad right stick Y axis 594 GAMEPAD_AXIS_LEFT_TRIGGER = 4, /// Gamepad back trigger left, pressure level: [1..-1] 595 GAMEPAD_AXIS_RIGHT_TRIGGER = 5 /// Gamepad back trigger right, pressure level: [1..-1] 596 } 597 598 /// Material map index 599 enum MaterialMapIndex 600 { 601 MATERIAL_MAP_ALBEDO = 0, /// Albedo material (same as: MATERIAL_MAP_DIFFUSE) 602 MATERIAL_MAP_METALNESS, /// Metalness material (same as: MATERIAL_MAP_SPECULAR) 603 MATERIAL_MAP_NORMAL, /// Normal material 604 MATERIAL_MAP_ROUGHNESS, /// Roughness material 605 MATERIAL_MAP_OCCLUSION, /// Ambient occlusion material 606 MATERIAL_MAP_EMISSION, /// Emission material 607 MATERIAL_MAP_HEIGHT, /// Heightmap material 608 MATERIAL_MAP_CUBEMAP, /// Cubemap material (NOTE: Uses GL_TEXTURE_CUBE_MAP) 609 MATERIAL_MAP_IRRADIANCE, /// Irradiance material (NOTE: Uses GL_TEXTURE_CUBE_MAP) 610 MATERIAL_MAP_PREFILTER, /// Prefilter material (NOTE: Uses GL_TEXTURE_CUBE_MAP) 611 MATERIAL_MAP_BRDF /// Brdf material 612 } 613 614 alias MATERIAL_MAP_DIFFUSE = MaterialMapIndex.MATERIAL_MAP_ALBEDO; 615 alias MATERIAL_MAP_SPECULAR = MaterialMapIndex.MATERIAL_MAP_METALNESS; 616 617 /// Shader location index 618 enum ShaderLocationIndex 619 { 620 SHADER_LOC_VERTEX_POSITION = 0, /// Shader location: vertex attribute: position 621 SHADER_LOC_VERTEX_TEXCOORD01, /// Shader location: vertex attribute: texcoord01 622 SHADER_LOC_VERTEX_TEXCOORD02, /// Shader location: vertex attribute: texcoord02 623 SHADER_LOC_VERTEX_NORMAL, /// Shader location: vertex attribute: normal 624 SHADER_LOC_VERTEX_TANGENT, /// Shader location: vertex attribute: tangent 625 SHADER_LOC_VERTEX_COLOR, /// Shader location: vertex attribute: color 626 SHADER_LOC_MATRIX_MVP, /// Shader location: matrix uniform: model-view-projection 627 SHADER_LOC_MATRIX_VIEW, /// Shader location: matrix uniform: view (camera transform) 628 SHADER_LOC_MATRIX_PROJECTION, /// Shader location: matrix uniform: projection 629 SHADER_LOC_MATRIX_MODEL, /// Shader location: matrix uniform: model (transform) 630 SHADER_LOC_MATRIX_NORMAL, /// Shader location: matrix uniform: normal 631 SHADER_LOC_VECTOR_VIEW, /// Shader location: vector uniform: view 632 SHADER_LOC_COLOR_DIFFUSE, /// Shader location: vector uniform: diffuse color 633 SHADER_LOC_COLOR_SPECULAR, /// Shader location: vector uniform: specular color 634 SHADER_LOC_COLOR_AMBIENT, /// Shader location: vector uniform: ambient color 635 SHADER_LOC_MAP_ALBEDO, /// Shader location: sampler2d texture: albedo (same as: SHADER_LOC_MAP_DIFFUSE) 636 SHADER_LOC_MAP_METALNESS, /// Shader location: sampler2d texture: metalness (same as: SHADER_LOC_MAP_SPECULAR) 637 SHADER_LOC_MAP_NORMAL, /// Shader location: sampler2d texture: normal 638 SHADER_LOC_MAP_ROUGHNESS, /// Shader location: sampler2d texture: roughness 639 SHADER_LOC_MAP_OCCLUSION, /// Shader location: sampler2d texture: occlusion 640 SHADER_LOC_MAP_EMISSION, /// Shader location: sampler2d texture: emission 641 SHADER_LOC_MAP_HEIGHT, /// Shader location: sampler2d texture: height 642 SHADER_LOC_MAP_CUBEMAP, /// Shader location: samplerCube texture: cubemap 643 SHADER_LOC_MAP_IRRADIANCE, /// Shader location: samplerCube texture: irradiance 644 SHADER_LOC_MAP_PREFILTER, /// Shader location: samplerCube texture: prefilter 645 SHADER_LOC_MAP_BRDF /// Shader location: sampler2d texture: brdf 646 } 647 648 alias SHADER_LOC_MAP_DIFFUSE = ShaderLocationIndex.SHADER_LOC_MAP_ALBEDO; 649 alias SHADER_LOC_MAP_SPECULAR = ShaderLocationIndex.SHADER_LOC_MAP_METALNESS; 650 651 /// Shader uniform data type 652 enum ShaderUniformDataType 653 { 654 SHADER_UNIFORM_FLOAT = 0, /// Shader uniform type: float 655 SHADER_UNIFORM_VEC2, /// Shader uniform type: vec2 (2 float) 656 SHADER_UNIFORM_VEC3, /// Shader uniform type: vec3 (3 float) 657 SHADER_UNIFORM_VEC4, /// Shader uniform type: vec4 (4 float) 658 SHADER_UNIFORM_INT, /// Shader uniform type: int 659 SHADER_UNIFORM_IVEC2, /// Shader uniform type: ivec2 (2 int) 660 SHADER_UNIFORM_IVEC3, /// Shader uniform type: ivec3 (3 int) 661 SHADER_UNIFORM_IVEC4, /// Shader uniform type: ivec4 (4 int) 662 SHADER_UNIFORM_SAMPLER2D /// Shader uniform type: sampler2d 663 } 664 665 /// Shader attribute data types 666 enum ShaderAttributeDataType 667 { 668 SHADER_ATTRIB_FLOAT = 0, /// Shader attribute type: float 669 SHADER_ATTRIB_VEC2, /// Shader attribute type: vec2 (2 float) 670 SHADER_ATTRIB_VEC3, /// Shader attribute type: vec3 (3 float) 671 SHADER_ATTRIB_VEC4 /// Shader attribute type: vec4 (4 float) 672 } 673 674 /// Pixel formats 675 /// NOTE: Support depends on OpenGL version and platform 676 enum PixelFormat 677 { 678 PIXELFORMAT_UNCOMPRESSED_GRAYSCALE = 1, /// 8 bit per pixel (no alpha) 679 PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA, /// 8*2 bpp (2 channels) 680 PIXELFORMAT_UNCOMPRESSED_R5G6B5, /// 16 bpp 681 PIXELFORMAT_UNCOMPRESSED_R8G8B8, /// 24 bpp 682 PIXELFORMAT_UNCOMPRESSED_R5G5B5A1, /// 16 bpp (1 bit alpha) 683 PIXELFORMAT_UNCOMPRESSED_R4G4B4A4, /// 16 bpp (4 bit alpha) 684 PIXELFORMAT_UNCOMPRESSED_R8G8B8A8, /// 32 bpp 685 PIXELFORMAT_UNCOMPRESSED_R32, /// 32 bpp (1 channel - float) 686 PIXELFORMAT_UNCOMPRESSED_R32G32B32, /// 32*3 bpp (3 channels - float) 687 PIXELFORMAT_UNCOMPRESSED_R32G32B32A32, /// 32*4 bpp (4 channels - float) 688 PIXELFORMAT_COMPRESSED_DXT1_RGB, /// 4 bpp (no alpha) 689 PIXELFORMAT_COMPRESSED_DXT1_RGBA, /// 4 bpp (1 bit alpha) 690 PIXELFORMAT_COMPRESSED_DXT3_RGBA, /// 8 bpp 691 PIXELFORMAT_COMPRESSED_DXT5_RGBA, /// 8 bpp 692 PIXELFORMAT_COMPRESSED_ETC1_RGB, /// 4 bpp 693 PIXELFORMAT_COMPRESSED_ETC2_RGB, /// 4 bpp 694 PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA, /// 8 bpp 695 PIXELFORMAT_COMPRESSED_PVRT_RGB, /// 4 bpp 696 PIXELFORMAT_COMPRESSED_PVRT_RGBA, /// 4 bpp 697 PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA, /// 8 bpp 698 PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA /// 2 bpp 699 } 700 701 /// Texture parameters: filter mode 702 /// NOTE 1: Filtering considers mipmaps if available in the texture 703 /// NOTE 2: Filter is accordingly set for minification and magnification 704 enum TextureFilter 705 { 706 TEXTURE_FILTER_POINT = 0, /// No filter, just pixel aproximation 707 TEXTURE_FILTER_BILINEAR, /// Linear filtering 708 TEXTURE_FILTER_TRILINEAR, /// Trilinear filtering (linear with mipmaps) 709 TEXTURE_FILTER_ANISOTROPIC_4X, /// Anisotropic filtering 4x 710 TEXTURE_FILTER_ANISOTROPIC_8X, /// Anisotropic filtering 8x 711 TEXTURE_FILTER_ANISOTROPIC_16X, /// Anisotropic filtering 16x 712 } 713 714 /// Texture parameters: wrap mode 715 enum TextureWrap 716 { 717 TEXTURE_WRAP_REPEAT = 0, /// Repeats texture in tiled mode 718 TEXTURE_WRAP_CLAMP, /// Clamps texture to edge pixel in tiled mode 719 TEXTURE_WRAP_MIRROR_REPEAT, /// Mirrors and repeats the texture in tiled mode 720 TEXTURE_WRAP_MIRROR_CLAMP /// Mirrors and clamps to border the texture in tiled mode 721 } 722 723 /// Cubemap layouts 724 enum CubemapLayout 725 { 726 CUBEMAP_LAYOUT_AUTO_DETECT = 0, /// Automatically detect layout type 727 CUBEMAP_LAYOUT_LINE_VERTICAL, /// Layout is defined by a vertical line with faces 728 CUBEMAP_LAYOUT_LINE_HORIZONTAL, /// Layout is defined by an horizontal line with faces 729 CUBEMAP_LAYOUT_CROSS_THREE_BY_FOUR, /// Layout is defined by a 3x4 cross with cubemap faces 730 CUBEMAP_LAYOUT_CROSS_FOUR_BY_THREE, /// Layout is defined by a 4x3 cross with cubemap faces 731 CUBEMAP_LAYOUT_PANORAMA /// Layout is defined by a panorama image (equirectangular map) 732 } 733 734 /// Font type, defines generation method 735 enum FontType 736 { 737 FONT_DEFAULT = 0, /// Default font generation, anti-aliased 738 FONT_BITMAP, /// Bitmap font generation, no anti-aliasing 739 FONT_SDF /// SDF font generation, requires external shader 740 } 741 742 /// Color blending modes (pre-defined) 743 enum BlendMode 744 { 745 BLEND_ALPHA = 0, /// Blend textures considering alpha (default) 746 BLEND_ADDITIVE, /// Blend textures adding colors 747 BLEND_MULTIPLIED, /// Blend textures multiplying colors 748 BLEND_ADD_COLORS, /// Blend textures adding colors (alternative) 749 BLEND_SUBTRACT_COLORS, /// Blend textures subtracting colors (alternative) 750 BLEND_CUSTOM /// Belnd textures using custom src/dst factors (use rlSetBlendMode()) 751 } 752 753 /// Gesture 754 /// NOTE: It could be used as flags to enable only some gestures 755 enum Gesture 756 { 757 GESTURE_NONE = 0, /// No gesture 758 GESTURE_TAP = 1, /// Tap gesture 759 GESTURE_DOUBLETAP = 2, /// Double tap gesture 760 GESTURE_HOLD = 4, /// Hold gesture 761 GESTURE_DRAG = 8, /// Drag gesture 762 GESTURE_SWIPE_RIGHT = 16, /// Swipe right gesture 763 GESTURE_SWIPE_LEFT = 32, /// Swipe left gesture 764 GESTURE_SWIPE_UP = 64, /// Swipe up gesture 765 GESTURE_SWIPE_DOWN = 128, /// Swipe down gesture 766 GESTURE_PINCH_IN = 256, /// Pinch in gesture 767 GESTURE_PINCH_OUT = 512 /// Pinch out gesture 768 } 769 770 /// Camera system modes 771 enum CameraMode 772 { 773 CAMERA_CUSTOM = 0, /// Custom camera 774 CAMERA_FREE, /// Free camera 775 CAMERA_ORBITAL, /// Orbital camera 776 CAMERA_FIRST_PERSON, /// First person camera 777 CAMERA_THIRD_PERSON /// Third person camera 778 } 779 780 /// Camera projection 781 enum CameraProjection 782 { 783 CAMERA_PERSPECTIVE = 0, /// Perspective projection 784 CAMERA_ORTHOGRAPHIC /// Orthographic projection 785 } 786 787 /// N-patch layout 788 enum NPatchLayout 789 { 790 NPATCH_NINE_PATCH = 0, /// Npatch layout: 3x3 tiles 791 NPATCH_THREE_PATCH_VERTICAL, /// Npatch layout: 1x3 tiles 792 NPATCH_THREE_PATCH_HORIZONTAL /// Npatch layout: 3x1 tiles 793 } 794 795 // Callbacks to hook some internal functions 796 // WARNING: This callbacks are intended for advance users 797 798 alias TraceLogCallback = void function(int logLevel, const(char*) text, va_list args); /// Logging: Redirect trace log messages 799 alias LoadFileDataCallback = ubyte function(const(char*) fileName, uint* bytesRead); /// FileIO: Load binary data 800 alias SaveFileDataCallback = bool function(const(char*) fileName, void* data, uint bytesToWrite); /// FileIO: Save binary data 801 alias LoadFileTextCallback = char function(const(char*) fileName); /// FileIO: Load text data 802 alias SaveFileTextCallback = bool function(const(char*) fileName, char* text); /// FileIO: Save text data 803 804 //------------------------------------------------------------------------------------ 805 // Global Variables Definition 806 //------------------------------------------------------------------------------------ 807 // It's lonely here... 808 809 //------------------------------------------------------------------------------------ 810 // Window and Graphics Device Functions (Module: core) 811 //------------------------------------------------------------------------------------ 812 813 /// Initialize window and OpenGL context 814 void InitWindow(int width, int height, const(char*) title); 815 /// Check if KEY_ESCAPE pressed or Close icon pressed 816 bool WindowShouldClose(); 817 /// Close window and unload OpenGL context 818 void CloseWindow(); 819 /// Check if window has been initialized successfully 820 bool IsWindowReady(); 821 /// Check if window is currently fullscreen 822 bool IsWindowFullscreen(); 823 /// Check if window is currently hidden (only PLATFORM_DESKTOP) 824 bool IsWindowHidden(); 825 /// Check if window is currently minimized (only PLATFORM_DESKTOP) 826 bool IsWindowMinimized(); 827 /// Check if window is currently maximized (only PLATFORM_DESKTOP) 828 bool IsWindowMaximized(); 829 /// Check if window is currently focused (only PLATFORM_DESKTOP) 830 bool IsWindowFocused(); 831 /// Check if window has been resized last frame 832 bool IsWindowResized(); 833 /// Check if one specific window flag is enabled 834 bool IsWindowState(uint flag); 835 /// Set window configuration state using flags 836 void SetWindowState(uint flags); 837 /// Clear window configuration state flags 838 void ClearWindowState(uint flags); 839 /// Toggle window state: fullscreen/windowed (only PLATFORM_DESKTOP) 840 void ToggleFullscreen(); 841 /// Set window state: maximized, if resizable (only PLATFORM_DESKTOP) 842 void MaximizeWindow(); 843 /// Set window state: minimized, if resizable (only PLATFORM_DESKTOP) 844 void MinimizeWindow(); 845 /// Set window state: not minimized/maximized (only PLATFORM_DESKTOP) 846 void RestoreWindow(); 847 /// Set icon for window (only PLATFORM_DESKTOP) 848 void SetWindowIcon(Image image); 849 /// Set title for window (only PLATFORM_DESKTOP) 850 void SetWindowTitle(const(char*) title); 851 /// Set window position on screen (only PLATFORM_DESKTOP) 852 void SetWindowPosition(int x, int y); 853 /// Set monitor for the current window (fullscreen mode) 854 void SetWindowMonitor(int monitor); 855 /// Set window minimum dimensions (for FLAG_WINDOW_RESIZABLE) 856 void SetWindowMinSize(int width, int height); 857 /// Set window dimensions 858 void SetWindowSize(int width, int height); 859 /// Get native window handle 860 void* GetWindowHandle(); 861 /// Get current screen width 862 int GetScreenWidth(); 863 /// Get current screen height 864 int GetScreenHeight(); 865 /// Get number of connected monitors 866 int GetMonitorCount(); 867 /// Get current connected monitor 868 int GetCurrentMonitor(); 869 /// Get specified monitor position 870 Vector2 GetMonitorPosition(int monitor); 871 /// Get specified monitor width (max available by monitor) 872 int GetMonitorWidth(int monitor); 873 /// Get specified monitor height (max available by monitor) 874 int GetMonitorHeight(int monitor); 875 /// Get specified monitor physical width in millimetres 876 int GetMonitorPhysicalWidth(int monitor); 877 /// Get specified monitor physical height in millimetres 878 int GetMonitorPhysicalHeight(int monitor); 879 /// Get specified monitor refresh rate 880 int GetMonitorRefreshRate(int monitor); 881 /// Get window position XY on monitor 882 Vector2 GetWindowPosition(); 883 /// Get window scale DPI factor 884 Vector2 GetWindowScaleDPI(); 885 /// Get the human-readable, UTF-8 encoded name of the primary monitor 886 const(char*) GetMonitorName(int monitor); 887 /// Set clipboard text content 888 void SetClipboardText(const(char*) text); 889 /// Get clipboard text content 890 const(char*) GetClipboardText(); 891 892 // Custom frame control functions 893 // NOTE: Those functions are intended for advance users that want full control over the frame processing 894 // By default EndDrawing() does this job: draws everything + SwapScreenBuffer() + manage frame timming + PollInputEvents() 895 // To avoid that behaviour and control frame processes manually, enable in config.h: SUPPORT_CUSTOM_FRAME_CONTROL 896 /// Swap back buffer with front buffer (screen drawing) 897 void SwapScreenBuffer(); 898 /// Register all input events 899 void PollInputEvents(); 900 /// Wait for some milliseconds (halt program execution) 901 void WaitTime(float ms); 902 903 // Cursor-related functions 904 /// Shows cursor 905 void ShowCursor(); 906 /// Hides cursor 907 void HideCursor(); 908 /// Check if cursor is not visible 909 bool IsCursorHidden(); 910 /// Enables cursor (unlock cursor) 911 void EnableCursor(); 912 /// Disables cursor (lock cursor) 913 void DisableCursor(); 914 /// Check if cursor is on the screen 915 bool IsCursorOnScreen(); 916 917 // Drawing-related functions 918 /// Set background color (framebuffer clear color) 919 void ClearBackground(Color color); 920 /// Setup canvas (framebuffer) to start drawing 921 void BeginDrawing(); 922 /// End canvas drawing and swap buffers (double buffering) 923 void EndDrawing(); 924 /// Begin 2D mode with custom camera (2D) 925 void BeginMode2D(Camera2D camera); 926 /// Ends 2D mode with custom camera 927 void EndMode2D(); 928 /// Begin 3D mode with custom camera (3D) 929 void BeginMode3D(Camera3D camera); 930 /// Ends 3D mode and returns to default 2D orthographic mode 931 void EndMode3D(); 932 /// Begin drawing to render texture 933 void BeginTextureMode(RenderTexture2D target); 934 /// Ends drawing to render texture 935 void EndTextureMode(); 936 /// Begin custom shader drawing 937 void BeginShaderMode(Shader shader); 938 /// End custom shader drawing (use default shader) 939 void EndShaderMode(); 940 /// Begin blending mode (alpha, additive, multiplied, subtract, custom) 941 void BeginBlendMode(int mode); 942 /// End blending mode (reset to default: alpha blending) 943 void EndBlendMode(); 944 /// Begin scissor mode (define screen area for following drawing) 945 void BeginScissorMode(int x, int y, int width, int height); 946 /// End scissor mode 947 void EndScissorMode(); 948 /// Begin stereo rendering (requires VR simulator) 949 void BeginVrStereoMode(VrStereoConfig config); 950 /// End stereo rendering (requires VR simulator) 951 void EndVrStereoMode(); 952 953 // VR stereo config functions for VR simulator 954 /// Load VR stereo config for VR simulator device parameters 955 VrStereoConfig LoadVrStereoConfig(VrDeviceInfo device); 956 /// Unload VR stereo config 957 void UnloadVrStereoConfig(VrStereoConfig config); 958 959 // Shader management functions 960 // NOTE: Shader functionality is not available on OpenGL 1.1 961 /// Load shader from files and bind default locations 962 Shader LoadShader(const(char*) vsFileName, const(char*) fsFileName); 963 /// Load shader from code strings and bind default locations 964 Shader LoadShaderFromMemory(const(char*) vsCode, const(char*) fsCode); 965 /// Get shader uniform location 966 int GetShaderLocation(Shader shader, const(char*) uniformName); 967 /// Get shader attribute location 968 int GetShaderLocationAttrib(Shader shader, const(char*) attribName); 969 /// Set shader uniform value 970 void SetShaderValue(Shader shader, int locIndex, const void* value, int uniformType); 971 /// Set shader uniform value vector 972 void SetShaderValueV(Shader shader, int locIndex, const void* value, int uniformType, int count); 973 /// Set shader uniform value (matrix 4x4) 974 void SetShaderValueMatrix(Shader shader, int locIndex, Matrix mat); 975 /// Set shader uniform value for texture (sampler2d) 976 void SetShaderValueTexture(Shader shader, int locIndex, Texture2D texture); 977 /// Unload shader from GPU memory (VRAM) 978 void UnloadShader(Shader shader); 979 980 // Screen-space-related functions 981 /// Get a ray trace from mouse position 982 Ray GetMouseRay(Vector2 mousePosition, Camera camera); 983 /// Get camera transform matrix (view matrix) 984 Matrix GetCameraMatrix(Camera camera); 985 /// Get camera 2d transform matrix 986 Matrix GetCameraMatrix2D(Camera2D camera); 987 /// Get the screen space position for a 3d world space position 988 Vector2 GetWorldToScreen(Vector3 position, Camera camera); 989 /// Get size position for a 3d world space position 990 Vector2 GetWorldToScreenEx(Vector3 position, Camera camera, int width, int height); 991 /// Get the screen space position for a 2d camera world space position 992 Vector2 GetWorldToScreen2D(Vector2 position, Camera2D camera); 993 /// Get the world space position for a 2d camera screen space position 994 Vector2 GetScreenToWorld2D(Vector2 position, Camera2D camera); 995 996 // Timing-related functions 997 /// Set target FPS (maximum) 998 void SetTargetFPS(int fps); 999 /// Get current FPS 1000 int GetFPS(); 1001 /// Get time in seconds for last frame drawn (delta time) 1002 float GetFrameTime(); 1003 /// Get elapsed time in seconds since InitWindow() 1004 double GetTime(); 1005 1006 // Misc. functions 1007 /// Get a random value between min and max (both included) 1008 int GetRandomValue(int min, int max); 1009 /// Set the seed for the random number generator 1010 void SetRandomSeed(uint seed); 1011 /// Takes a screenshot of current screen (filename extension defines format) 1012 void TakeScreenshot(const(char*) fileName); 1013 /// Setup init configuration flags (view FLAGS) 1014 void SetConfigFlags(uint flags); 1015 /// Show trace log messages (LOG_DEBUG, LOG_INFO, LOG_WARNING, LOG_ERROR...) 1016 void TraceLog(int logLevel, const(char*) text, ...); 1017 /// Set the current threshold (minimum) log level 1018 void SetTraceLogLevel(int logLevel); 1019 /// Internal memory allocator 1020 void* MemAlloc(int size); 1021 /// Internal memory reallocator 1022 void* MemRealloc(void* ptr, int size); 1023 /// Internal memory free 1024 void MemFree(void* ptr); 1025 1026 // Set custom callbacks 1027 // WARNING: Callbacks setup is intended for advance users 1028 /// Set custom trace log 1029 void SetTraceLogCallback(TraceLogCallback callback); 1030 /// Set custom file binary data loader 1031 void SetLoadFileDataCallback(LoadFileDataCallback callback); 1032 /// Set custom file binary data saver 1033 void SetSaveFileDataCallback(SaveFileDataCallback callback); 1034 /// Set custom file text data loader 1035 void SetLoadFileTextCallback(LoadFileTextCallback callback); 1036 /// Set custom file text data saver 1037 void SetSaveFileTextCallback(SaveFileTextCallback callback); 1038 1039 // Files management functions 1040 /// Load file data as byte array (read) 1041 ubyte* LoadFileData(const(char*) fileName, uint* bytesRead); 1042 /// Unload file data allocated by LoadFileData() 1043 void UnloadFileData(ubyte* data); 1044 /// Save data to file from byte array (write), returns true on success 1045 bool SaveFileData(const(char*) fileName, void* data, uint bytesToWrite); 1046 /// Load text data from file (read), returns a '\0' terminated string 1047 char* LoadFileText(const(char*) fileName); 1048 /// Unload file text data allocated by LoadFileText() 1049 void UnloadFileText(char* text); 1050 /// Save text data to file (write), string must be '\0' terminated, returns true on success 1051 bool SaveFileText(const(char*) fileName, char* text); 1052 /// Check if file exists 1053 bool FileExists(const(char*) fileName); 1054 /// Check if a directory path exists 1055 bool DirectoryExists(const(char*) dirPath); 1056 /// Check file extension (including point: .png, .wav) 1057 bool IsFileExtension(const(char*) fileName, const(char*) ext); 1058 /// Get pointer to extension for a filename string (includes dot: '.png') 1059 const(char*) GetFileExtension(const(char*) fileName); 1060 /// Get pointer to filename for a path string 1061 const(char*) GetFileName(const(char*) filePath); 1062 /// Get filename string without extension (uses static string) 1063 const(char*) GetFileNameWithoutExt(const(char*) filePath); 1064 /// Get full path for a given fileName with path (uses static string) 1065 const(char*) GetDirectoryPath(const(char*) filePath); 1066 /// Get previous directory path for a given path (uses static string) 1067 const(char*) GetPrevDirectoryPath(const(char*) dirPath); 1068 /// Get current working directory (uses static string) 1069 const(char*) GetWorkingDirectory(); 1070 /// Get filenames in a directory path (memory should be freed) 1071 char** GetDirectoryFiles(const(char*) dirPath, int* count); 1072 /// Clear directory files paths buffers (free memory) 1073 void ClearDirectoryFiles(); 1074 /// Change working directory, return true on success 1075 bool ChangeDirectory(const(char*) dir); 1076 /// Check if a file has been dropped into window 1077 bool IsFileDropped(); 1078 /// Get dropped files names (memory should be freed) 1079 char** GetDroppedFiles(int* count); 1080 /// Clear dropped files paths buffer (free memory) 1081 void ClearDroppedFiles(); 1082 /// Get file modification time (last write time) 1083 long GetFileModTime(const(char*) fileName); 1084 1085 // Compression/Encoding functionality 1086 /// Compress data (DEFLATE algorithm) 1087 ubyte* CompressData(ubyte* data, int dataLength, int* compDataLength); 1088 /// Decompress data (DEFLATE algorithm) 1089 ubyte* DecompressData(ubyte* compData, int compDataLength, int* dataLength); 1090 /// Encode data to Base64 string 1091 char* EncodeDataBase64(const ubyte* data, int dataLength, int* outputLength); 1092 /// Decode Base64 string data 1093 ubyte* DecodeDataBase64(ubyte* data, int* outputLength); 1094 1095 // Persistent storage management 1096 /// Save integer value to storage file (to defined position), returns true on success 1097 bool SaveStorageValue(uint position, int value); 1098 /// Load integer value from storage file (from defined position) 1099 int LoadStorageValue(uint position); 1100 /// Open URL with default system browser (if available) 1101 void OpenURL(const(char*) url); 1102 1103 //------------------------------------------------------------------------------------ 1104 // Input Handling Functions (Module: core) 1105 //------------------------------------------------------------------------------------ 1106 1107 // Input-related functions: keyboard 1108 /// Check if a key has been pressed once 1109 bool IsKeyPressed(int key); 1110 /// Check if a key is being pressed 1111 bool IsKeyDown(int key); 1112 /// Check if a key has been released once 1113 bool IsKeyReleased(int key); 1114 /// Check if a key is NOT being pressed 1115 bool IsKeyUp(int key); 1116 /// Set a custom key to exit program (default is ESC) 1117 void SetExitKey(int key); 1118 /// Get key pressed (keycode), call it multiple times for keys queued, returns 0 when the queue is empty 1119 int GetKeyPressed(); 1120 /// Get char pressed (unicode), call it multiple times for chars queued, returns 0 when the queue is empty 1121 int GetCharPressed(); 1122 1123 // Input-related functions: gamepads 1124 /// Check if a gamepad is available 1125 bool IsGamepadAvailable(int gamepad); 1126 /// Check gamepad name (if available) 1127 /// Deprecated: Removed from Raylib `4.0.0` 1128 bool IsGamepadName(int gamepad, const(char*) name); 1129 /// Get gamepad internal name id 1130 const(char*) GetGamepadName(int gamepad); 1131 /// Check if a gamepad button has been pressed once 1132 bool IsGamepadButtonPressed(int gamepad, int button); 1133 /// Check if a gamepad button is being pressed 1134 bool IsGamepadButtonDown(int gamepad, int button); 1135 /// Check if a gamepad button has been released once 1136 bool IsGamepadButtonReleased(int gamepad, int button); 1137 /// Check if a gamepad button is NOT being pressed 1138 bool IsGamepadButtonUp(int gamepad, int button); 1139 /// Get the last gamepad button pressed 1140 int GetGamepadButtonPressed(); 1141 /// Get gamepad axis count for a gamepad 1142 int GetGamepadAxisCount(int gamepad); 1143 /// Get axis movement value for a gamepad axis 1144 float GetGamepadAxisMovement(int gamepad, int axis); 1145 /// Set internal gamepad mappings (SDL_GameControllerDB) 1146 int SetGamepadMappings(const(char*) mappings); 1147 1148 // Input-related functions: mouse 1149 /// Check if a mouse button has been pressed once 1150 bool IsMouseButtonPressed(int button); 1151 /// Check if a mouse button is being pressed 1152 bool IsMouseButtonDown(int button); 1153 /// Check if a mouse button has been released once 1154 bool IsMouseButtonReleased(int button); 1155 /// Check if a mouse button is NOT being pressed 1156 bool IsMouseButtonUp(int button); 1157 /// Get mouse position X 1158 int GetMouseX(); 1159 /// Get mouse position Y 1160 int GetMouseY(); 1161 /// Get mouse position XY 1162 Vector2 GetMousePosition(); 1163 /// Get mouse delta between frames 1164 Vector2 GetMouseDelta(); 1165 /// Set mouse position XY 1166 void SetMousePosition(int x, int y); 1167 /// Set mouse offset 1168 void SetMouseOffset(int offsetX, int offsetY); 1169 /// Set mouse scaling 1170 void SetMouseScale(float scaleX, float scaleY); 1171 /// Get mouse wheel movement Y 1172 float GetMouseWheelMove(); 1173 /// Set mouse cursor 1174 void SetMouseCursor(int cursor); 1175 1176 // Input-related functions: touch 1177 /// Get touch position X for touch point 0 (relative to screen size) 1178 int GetTouchX(); 1179 /// Get touch position Y for touch point 0 (relative to screen size) 1180 int GetTouchY(); 1181 /// Get touch position XY for a touch point index (relative to screen size) 1182 Vector2 GetTouchPosition(int index); 1183 /// Get touch point identifier for given index 1184 int GetTouchPointId(int index); 1185 /// Get number of touch points 1186 int GetTouchPointCount(); 1187 1188 //------------------------------------------------------------------------------------ 1189 // Gestures and Touch Handling Functions (Module: rgestures) 1190 //------------------------------------------------------------------------------------ 1191 /// Enable a set of gestures using flags 1192 void SetGesturesEnabled(uint flags); 1193 /// Check if a gesture have been detected 1194 bool IsGestureDetected(int gesture); 1195 /// Get latest detected gesture 1196 int GetGestureDetected(); 1197 /// Get gesture hold time in milliseconds 1198 float GetGestureHoldDuration(); 1199 /// Get gesture drag vector 1200 Vector2 GetGestureDragVector(); 1201 /// Get gesture drag angle 1202 float GetGestureDragAngle(); 1203 /// Get gesture pinch delta 1204 Vector2 GetGesturePinchVector(); 1205 /// Get gesture pinch angle 1206 float GetGesturePinchAngle(); 1207 1208 //------------------------------------------------------------------------------------ 1209 // Camera System Functions (Module: rcamera) 1210 //------------------------------------------------------------------------------------ 1211 /// Set camera mode (multiple camera modes available) 1212 void SetCameraMode(Camera camera, int mode); 1213 /// Update camera position for selected mode 1214 void UpdateCamera(Camera* camera); 1215 /// Set camera pan key to combine with mouse movement (free camera) 1216 void SetCameraPanControl(int keyPan); 1217 /// Set camera alt key to combine with mouse movement (free camera) 1218 void SetCameraAltControl(int keyAlt); 1219 /// Set camera smooth zoom key to combine with mouse (free camera) 1220 void SetCameraSmoothZoomControl(int keySmoothZoom); 1221 /// Set camera move controls (1st person and 3rd person cameras) 1222 void SetCameraMoveControls(int keyFront, int keyBack, int keyRight, int keyLeft, 1223 int keyUp, int keyDown); 1224 1225 //------------------------------------------------------------------------------------ 1226 // Basic Shapes Drawing Functions (Module: shapes) 1227 //------------------------------------------------------------------------------------ 1228 // Set texture and rectangle to be used on shapes drawing 1229 // NOTE: It can be useful when using basic shapes and one single font, 1230 // defining a font char white rectangle would allow drawing everything in a single draw call 1231 /// Set texture and rectangle to be used on shapes drawing 1232 void SetShapesTexture(Texture2D texture, Rectangle source); 1233 1234 // Basic shapes drawing functions 1235 /// Draw a pixel 1236 void DrawPixel(int posX, int posY, Color color); 1237 /// Draw a pixel (Vector version) 1238 void DrawPixelV(Vector2 position, Color color); 1239 /// Draw a line 1240 void DrawLine(int startPosX, int startPosY, int endPosX, int endPosY, Color color); 1241 /// Draw a line (Vector version) 1242 void DrawLineV(Vector2 startPos, Vector2 endPos, Color color); 1243 /// Draw a line defining thickness 1244 void DrawLineEx(Vector2 startPos, Vector2 endPos, float thick, Color color); 1245 /// Draw a line using cubic-bezier curves in-out 1246 void DrawLineBezier(Vector2 startPos, Vector2 endPos, float thick, Color color); 1247 /// Draw line using quadratic bezier curves with a control point 1248 void DrawLineBezierQuad(Vector2 startPos, Vector2 endPos, Vector2 controlPos, 1249 float thick, Color color); 1250 /// Draw line using cubic bezier curves with 2 control points 1251 void DrawLineBezierCubic(Vector2 startPos, Vector2 endPos, 1252 Vector2 startControlPos, Vector2 endControlPos, float thick, Color color); 1253 /// Draw lines sequence 1254 void DrawLineStrip(Vector2* points, int pointCount, Color color); 1255 /// Draw a color-filled circle 1256 void DrawCircle(int centerX, int centerY, float radius, Color color); 1257 /// Draw a piece of a circle 1258 void DrawCircleSector(Vector2 center, float radius, float startAngle, 1259 float endAngle, int segments, Color color); 1260 /// Draw circle sector outline 1261 void DrawCircleSectorLines(Vector2 center, float radius, float startAngle, 1262 float endAngle, int segments, Color color); 1263 /// Draw a gradient-filled circle 1264 void DrawCircleGradient(int centerX, int centerY, float radius, Color color1, Color color2); 1265 /// Draw a color-filled circle (Vector version) 1266 void DrawCircleV(Vector2 center, float radius, Color color); 1267 /// Draw circle outline 1268 void DrawCircleLines(int centerX, int centerY, float radius, Color color); 1269 /// Draw ellipse 1270 void DrawEllipse(int centerX, int centerY, float radiusH, float radiusV, Color color); 1271 /// Draw ellipse outline 1272 void DrawEllipseLines(int centerX, int centerY, float radiusH, float radiusV, Color color); 1273 /// Draw ring 1274 void DrawRing(Vector2 center, float innerRadius, float outerRadius, 1275 float startAngle, float endAngle, int segments, Color color); 1276 /// Draw ring outline 1277 void DrawRingLines(Vector2 center, float innerRadius, float outerRadius, 1278 float startAngle, float endAngle, int segments, Color color); 1279 /// Draw a color-filled rectangle 1280 void DrawRectangle(int posX, int posY, int width, int height, Color color); 1281 /// Draw a color-filled rectangle (Vector version) 1282 void DrawRectangleV(Vector2 position, Vector2 size, Color color); 1283 /// Draw a color-filled rectangle 1284 void DrawRectangleRec(Rectangle rec, Color color); 1285 /// Draw a color-filled rectangle with pro parameters 1286 void DrawRectanglePro(Rectangle rec, Vector2 origin, float rotation, Color color); 1287 /// Draw a vertical-gradient-filled rectangle 1288 void DrawRectangleGradientV(int posX, int posY, int width, int height, Color color1, Color color2); 1289 /// Draw a horizontal-gradient-filled rectangle 1290 void DrawRectangleGradientH(int posX, int posY, int width, int height, Color color1, Color color2); 1291 /// Draw a gradient-filled rectangle with custom vertex colors 1292 void DrawRectangleGradientEx(Rectangle rec, Color col1, Color col2, Color col3, Color col4); 1293 /// Draw rectangle outline 1294 void DrawRectangleLines(int posX, int posY, int width, int height, Color color); 1295 /// Draw rectangle outline with extended parameters 1296 void DrawRectangleLinesEx(Rectangle rec, float lineThick, Color color); 1297 /// Draw rectangle with rounded edges 1298 void DrawRectangleRounded(Rectangle rec, float roundness, int segments, Color color); 1299 /// Draw rectangle with rounded edges outline 1300 void DrawRectangleRoundedLines(Rectangle rec, float roundness, int segments, 1301 float lineThick, Color color); 1302 /// Draw a color-filled triangle (vertex in counter-clockwise order!) 1303 void DrawTriangle(Vector2 v1, Vector2 v2, Vector2 v3, Color color); 1304 /// Draw triangle outline (vertex in counter-clockwise order!) 1305 void DrawTriangleLines(Vector2 v1, Vector2 v2, Vector2 v3, Color color); 1306 /// Draw a triangle fan defined by points (first vertex is the center) 1307 void DrawTriangleFan(Vector2* points, int pointCount, Color color); 1308 /// Draw a triangle strip defined by points 1309 void DrawTriangleStrip(Vector2* points, int pointCount, Color color); 1310 /// Draw a regular polygon (Vector version) 1311 void DrawPoly(Vector2 center, int sides, float radius, float rotation, Color color); 1312 /// Draw a polygon outline of n sides 1313 void DrawPolyLines(Vector2 center, int sides, float radius, float rotation, Color color); 1314 /// Draw a polygon outline of n sides with extended parameters 1315 void DrawPolyLinesEx(Vector2 center, int sides, float radius, float rotation, 1316 float lineThick, Color color); 1317 1318 // Basic shapes collision detection functions 1319 /// Check collision between two rectangles 1320 bool CheckCollisionRecs(Rectangle rec1, Rectangle rec2); 1321 /// Check collision between two circles 1322 bool CheckCollisionCircles(Vector2 center1, float radius1, Vector2 center2, float radius2); 1323 /// Check collision between circle and rectangle 1324 bool CheckCollisionCircleRec(Vector2 center, float radius, Rectangle rec); 1325 /// Check if point is inside rectangle 1326 bool CheckCollisionPointRec(Vector2 point, Rectangle rec); 1327 /// Check if point is inside circle 1328 bool CheckCollisionPointCircle(Vector2 point, Vector2 center, float radius); 1329 /// Check if point is inside a triangle 1330 bool CheckCollisionPointTriangle(Vector2 point, Vector2 p1, Vector2 p2, Vector2 p3); 1331 /// Check the collision between two lines defined by two points each, returns collision point by reference 1332 bool CheckCollisionLines(Vector2 startPos1, Vector2 endPos1, Vector2 startPos2, 1333 Vector2 endPos2, Vector2* collisionPoint); 1334 /// Check if point belongs to line created between two points [p1] and [p2] with defined margin in pixels [threshold] 1335 bool CheckCollisionPointLine(Vector2 point, Vector2 p1, Vector2 p2, int threshold); 1336 /// Get collision rectangle for two rectangles collision 1337 Rectangle GetCollisionRec(Rectangle rec1, Rectangle rec2); 1338 1339 //------------------------------------------------------------------------------------ 1340 // Texture Loading and Drawing Functions (Module: textures) 1341 //------------------------------------------------------------------------------------ 1342 1343 // Image loading functions 1344 // NOTE: This functions do not require GPU access 1345 /// Load image from file into CPU memory (RAM) 1346 Image LoadImage(const(char*) fileName); 1347 /// Load image from RAW file data 1348 Image LoadImageRaw(const(char*) fileName, int width, int height, int format, int headerSize); 1349 /// Load image sequence from file (frames appended to image.data) 1350 Image LoadImageAnim(const(char*) fileName, int* frames); 1351 /// Load image from memory buffer, fileType refers to extension: i.e. '.png' 1352 Image LoadImageFromMemory(const(char*) fileType, const ubyte* fileData, int dataSize); 1353 /// Load image from GPU texture data 1354 Image LoadImageFromTexture(Texture2D texture); 1355 /// Load image from screen buffer and (screenshot) 1356 Image LoadImageFromScreen(); 1357 /// Unload image from CPU memory (RAM) 1358 void UnloadImage(Image image); 1359 /// Export image data to file, returns true on success 1360 bool ExportImage(Image image, const(char*) fileName); 1361 /// Export image as code file defining an array of bytes, returns true on success 1362 bool ExportImageAsCode(Image image, const(char*) fileName); 1363 1364 // Image generation functions 1365 /// Generate image: plain color 1366 Image GenImageColor(int width, int height, Color color); 1367 /// Generate image: vertical gradient 1368 Image GenImageGradientV(int width, int height, Color top, Color bottom); 1369 /// Generate image: horizontal gradient 1370 Image GenImageGradientH(int width, int height, Color left, Color right); 1371 /// Generate image: radial gradient 1372 Image GenImageGradientRadial(int width, int height, float density, Color inner, Color outer); 1373 /// Generate image: checked 1374 Image GenImageChecked(int width, int height, int checksX, int checksY, Color col1, Color col2); 1375 /// Generate image: white noise 1376 Image GenImageWhiteNoise(int width, int height, float factor); 1377 /// Generate image: cellular algorithm, bigger tileSize means bigger cells 1378 Image GenImageCellular(int width, int height, int tileSize); 1379 1380 // Image manipulation functions 1381 /// Create an image duplicate (useful for transformations) 1382 Image ImageCopy(Image image); 1383 /// Create an image from another image piece 1384 Image ImageFromImage(Image image, Rectangle rec); 1385 /// Create an image from text (default font) 1386 Image ImageText(const(char*) text, int fontSize, Color color); 1387 /// Create an image from text (custom sprite font) 1388 Image ImageTextEx(Font font, const(char*) text, float fontSize, float spacing, Color tint); 1389 /// Convert image data to desired format 1390 void ImageFormat(Image* image, int newFormat); 1391 /// Convert image to POT (power-of-two) 1392 void ImageToPOT(Image* image, Color fill); 1393 /// Crop an image to a defined rectangle 1394 void ImageCrop(Image* image, Rectangle crop); 1395 /// Crop image depending on alpha value 1396 void ImageAlphaCrop(Image* image, float threshold); 1397 /// Clear alpha channel to desired color 1398 void ImageAlphaClear(Image* image, Color color, float threshold); 1399 /// Apply alpha mask to image 1400 void ImageAlphaMask(Image* image, Image alphaMask); 1401 /// Premultiply alpha channel 1402 void ImageAlphaPremultiply(Image* image); 1403 /// Resize image (Bicubic scaling algorithm) 1404 void ImageResize(Image* image, int newWidth, int newHeight); 1405 /// Resize image (Nearest-Neighbor scaling algorithm) 1406 void ImageResizeNN(Image* image, int newWidth, int newHeight); 1407 /// Resize canvas and fill with color 1408 void ImageResizeCanvas(Image* image, int newWidth, int newHeight, int offsetX, 1409 int offsetY, Color fill); 1410 /// Compute all mipmap levels for a provided image 1411 void ImageMipmaps(Image* image); 1412 /// Dither image data to 16bpp or lower (Floyd-Steinberg dithering) 1413 void ImageDither(Image* image, int rBpp, int gBpp, int bBpp, int aBpp); 1414 /// Flip image vertically 1415 void ImageFlipVertical(Image* image); 1416 /// Flip image horizontally 1417 void ImageFlipHorizontal(Image* image); 1418 /// Rotate image clockwise 90deg 1419 void ImageRotateCW(Image* image); 1420 /// Rotate image counter-clockwise 90deg 1421 void ImageRotateCCW(Image* image); 1422 /// Modify image color: tint 1423 void ImageColorTint(Image* image, Color color); 1424 /// Modify image color: invert 1425 void ImageColorInvert(Image* image); 1426 /// Modify image color: grayscale 1427 void ImageColorGrayscale(Image* image); 1428 /// Modify image color: contrast (-100 to 100) 1429 void ImageColorContrast(Image* image, float contrast); 1430 /// Modify image color: brightness (-255 to 255) 1431 void ImageColorBrightness(Image* image, int brightness); 1432 /// Modify image color: replace color 1433 void ImageColorReplace(Image* image, Color color, Color replace); 1434 /// Load color data from image as a Color array (RGBA - 32bit) 1435 Color* LoadImageColors(Image image); 1436 /// Load colors palette from image as a Color array (RGBA - 32bit) 1437 Color* LoadImagePalette(Image image, int maxPaletteSize, int* colorCount); 1438 /// Unload color data loaded with LoadImageColors() 1439 void UnloadImageColors(Color* colors); 1440 /// Unload colors palette loaded with LoadImagePalette() 1441 void UnloadImagePalette(Color* colors); 1442 /// Get image alpha border rectangle 1443 Rectangle GetImageAlphaBorder(Image image, float threshold); 1444 /// Get image pixel color at (x, y) position 1445 Color GetImageColor(Image image, int x, int y); 1446 1447 // Image drawing functions 1448 // NOTE: Image software-rendering functions (CPU) 1449 /// Clear image background with given color 1450 void ImageClearBackground(Image* dst, Color color); 1451 /// Draw pixel within an image 1452 void ImageDrawPixel(Image* dst, int posX, int posY, Color color); 1453 /// Draw pixel within an image (Vector version) 1454 void ImageDrawPixelV(Image* dst, Vector2 position, Color color); 1455 /// Draw line within an image 1456 void ImageDrawLine(Image* dst, int startPosX, int startPosY, int endPosX, int endPosY, Color color); 1457 /// Draw line within an image (Vector version) 1458 void ImageDrawLineV(Image* dst, Vector2 start, Vector2 end, Color color); 1459 /// Draw circle within an image 1460 void ImageDrawCircle(Image* dst, int centerX, int centerY, int radius, Color color); 1461 /// Draw circle within an image (Vector version) 1462 void ImageDrawCircleV(Image* dst, Vector2 center, int radius, Color color); 1463 /// Draw rectangle within an image 1464 void ImageDrawRectangle(Image* dst, int posX, int posY, int width, int height, Color color); 1465 /// Draw rectangle within an image (Vector version) 1466 void ImageDrawRectangleV(Image* dst, Vector2 position, Vector2 size, Color color); 1467 /// Draw rectangle within an image 1468 void ImageDrawRectangleRec(Image* dst, Rectangle rec, Color color); 1469 /// Draw rectangle lines within an image 1470 void ImageDrawRectangleLines(Image* dst, Rectangle rec, int thick, Color color); 1471 /// Draw a source image within a destination image (tint applied to source) 1472 void ImageDraw(Image* dst, Image src, Rectangle srcRec, Rectangle dstRec, Color tint); 1473 /// Draw text (using default font) within an image (destination) 1474 void ImageDrawText(Image* dst, const(char*) text, int posX, int posY, int fontSize, Color color); 1475 /// Draw text (custom sprite font) within an image (destination) 1476 void ImageDrawTextEx(Image* dst, Font font, const(char*) text, Vector2 position, 1477 float fontSize, float spacing, Color tint); 1478 1479 // Texture loading functions 1480 // NOTE: These functions require GPU access 1481 /// Load texture from file into GPU memory (VRAM) 1482 Texture2D LoadTexture(const(char*) fileName); 1483 /// Load texture from image data 1484 Texture2D LoadTextureFromImage(Image image); 1485 /// Load cubemap from image, multiple image cubemap layouts supported 1486 TextureCubemap LoadTextureCubemap(Image image, int layout); 1487 /// Load texture for rendering (framebuffer) 1488 RenderTexture2D LoadRenderTexture(int width, int height); 1489 /// Unload texture from GPU memory (VRAM) 1490 void UnloadTexture(Texture2D texture); 1491 /// Unload render texture from GPU memory (VRAM) 1492 void UnloadRenderTexture(RenderTexture2D target); 1493 /// Update GPU texture with new data 1494 void UpdateTexture(Texture2D texture, const void* pixels); 1495 /// Update GPU texture rectangle with new data 1496 void UpdateTextureRec(Texture2D texture, Rectangle rec, const void* pixels); 1497 1498 // Texture configuration functions 1499 /// Generate GPU mipmaps for a texture 1500 void GenTextureMipmaps(Texture2D* texture); 1501 /// Set texture scaling filter mode 1502 void SetTextureFilter(Texture2D texture, int filter); 1503 /// Set texture wrapping mode 1504 void SetTextureWrap(Texture2D texture, int wrap); 1505 1506 /// Texture drawing functions 1507 /// Draw a Texture2D 1508 void DrawTexture(Texture2D texture, int posX, int posY, Color tint); 1509 /// Draw a Texture2D with position defined as Vector2 1510 void DrawTextureV(Texture2D texture, Vector2 position, Color tint); 1511 /// Draw a Texture2D with extended parameters 1512 void DrawTextureEx(Texture2D texture, Vector2 position, float rotation, float scale, Color tint); 1513 /// Draw a part of a texture defined by a rectangle 1514 void DrawTextureRec(Texture2D texture, Rectangle source, Vector2 position, Color tint); 1515 /// Draw texture quad with tiling and offset parameters 1516 void DrawTextureQuad(Texture2D texture, Vector2 tiling, Vector2 offset, Rectangle quad, Color tint); 1517 /// Draw part of a texture (defined by a rectangle) with rotation and scale tiled into dest. 1518 void DrawTextureTiled(Texture2D texture, Rectangle source, Rectangle dest, 1519 Vector2 origin, float rotation, float scale, Color tint); 1520 /// Draw a part of a texture defined by a rectangle with 'pro' parameters 1521 void DrawTexturePro(Texture2D texture, Rectangle source, Rectangle dest, 1522 Vector2 origin, float rotation, Color tint); 1523 /// Draws a texture (or part of it) that stretches or shrinks nicely 1524 void DrawTextureNPatch(Texture2D texture, NPatchInfo nPatchInfo, Rectangle dest, 1525 Vector2 origin, float rotation, Color tint); 1526 /// Draw a textured polygon 1527 void DrawTexturePoly(Texture2D texture, Vector2 center, Vector2* points, 1528 Vector2* texcoords, int pointCount, Color tint); 1529 1530 // Color/pixel related functions 1531 /// Get color with alpha applied, alpha goes from 0.0f to 1.0f 1532 Color Fade(Color color, float alpha); 1533 /// Get hexadecimal value for a Color 1534 int ColorToInt(Color color); 1535 /// Get Color normalized as float [0..1] 1536 Vector4 ColorNormalize(Color color); 1537 /// Get Color from normalized values [0..1] 1538 Color ColorFromNormalized(Vector4 normalized); 1539 /// Get HSV values for a Color, hue [0..360], saturation/value [0..1] 1540 Vector3 ColorToHSV(Color color); 1541 /// Get a Color from HSV values, hue [0..360], saturation/value [0..1] 1542 Color ColorFromHSV(float hue, float saturation, float value); 1543 /// Get color with alpha applied, alpha goes from 0.0f to 1.0f 1544 Color ColorAlpha(Color color, float alpha); 1545 /// Get src alpha-blended into dst color with tint 1546 Color ColorAlphaBlend(Color dst, Color src, Color tint); 1547 /// Get Color structure from hexadecimal value 1548 Color GetColor(uint hexValue); 1549 /// Get Color from a source pixel pointer of certain format 1550 Color GetPixelColor(void* srcPtr, int format); 1551 /// Set color formatted into destination pixel pointer 1552 void SetPixelColor(void* dstPtr, Color color, int format); 1553 /// Get pixel data size in bytes for certain format 1554 int GetPixelDataSize(int width, int height, int format); 1555 1556 ///------------------------------------------------------------------------------------ 1557 /// Font Loading and Text Drawing Functions (Module: text) 1558 ///------------------------------------------------------------------------------------ 1559 1560 // Font loading/unloading functions 1561 /// Get the default Font 1562 Font GetFontDefault(); 1563 /// Load font from file into GPU memory (VRAM) 1564 Font LoadFont(const(char*) fileName); 1565 /// Load font from file with extended parameters 1566 Font LoadFontEx(const(char*) fileName, int fontSize, int* fontChars, int glyphCount); 1567 /// Load font from Image (XNA style) 1568 Font LoadFontFromImage(Image image, Color key, int firstChar); 1569 /// Load font from memory buffer, fileType refers to extension: i.e. '.ttf' 1570 Font LoadFontFromMemory(const(char*) fileType, const ubyte* fileData, 1571 int dataSize, int fontSize, int* fontChars, int glyphCount); 1572 /// Load font data for further use 1573 GlyphInfo* LoadFontData(const ubyte* fileData, int dataSize, int fontSize, 1574 int* fontChars, int glyphCount, int type); 1575 /// Generate image font atlas using chars info 1576 Image GenImageFontAtlas(const GlyphInfo* chars, Rectangle** recs, 1577 int glyphCount, int fontSize, int padding, int packMethod); 1578 /// Unload font chars info data (RAM) 1579 void UnloadFontData(GlyphInfo* chars, int glyphCount); 1580 /// Unload Font from GPU memory (VRAM) 1581 void UnloadFont(Font font); 1582 1583 // Text drawing functions 1584 /// Draw current FPS 1585 void DrawFPS(int posX, int posY); 1586 /// Draw text (using default font) 1587 void DrawText(const(char*) text, int posX, int posY, int fontSize, Color color); 1588 /// Draw text using font and additional parameters 1589 void DrawTextEx(Font font, const(char*) text, Vector2 position, float fontSize, 1590 float spacing, Color tint); 1591 /// Draw text using Font and pro parameters (rotation) 1592 void DrawTextPro(Font font, const(char*) text, Vector2 position, Vector2 origin, 1593 float rotation, float fontSize, float spacing, Color tint); 1594 /// Draw one character (codepoint) 1595 void DrawTextCodepoint(Font font, int codepoint, Vector2 position, float fontSize, Color tint); 1596 1597 // Text font info functions 1598 /// Measure string width for default font 1599 int MeasureText(const(char*) text, int fontSize); 1600 /// Measure string size for Font 1601 Vector2 MeasureTextEx(Font font, const(char*) text, float fontSize, float spacing); 1602 /// Get glyph index position in font for a codepoint (unicode character), fallback to '?' if not found 1603 int GetGlyphIndex(Font font, int codepoint); 1604 /// Get glyph font info data for a codepoint (unicode character), fallback to '?' if not found 1605 GlyphInfo GetGlyphInfo(Font font, int codepoint); 1606 /// Get glyph rectangle in font atlas for a codepoint (unicode character), fallback to '?' if not found 1607 Rectangle GetGlyphAtlasRec(Font font, int codepoint); 1608 1609 // Text codepoints management functions (unicode characters) 1610 /// Load all codepoints from a UTF-8 text string, codepoints count returned by parameter 1611 int* LoadCodepoints(const(char*) text, int* count); 1612 /// Unload codepoints data from memory 1613 void UnloadCodepoints(int* codepoints); 1614 /// Get total number of codepoints in a UTF-8 encoded string 1615 int GetCodepointCount(const(char*) text); 1616 /// Get next codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure 1617 int GetCodepoint(const(char*) text, int* bytesProcessed); 1618 /// Encode one codepoint into UTF-8 byte array (array length returned as parameter) 1619 const(char*) CodepointToUTF8(int codepoint, int* byteSize); 1620 /// Encode text as codepoints array into UTF-8 text string (WARNING: memory must be freed!) 1621 char* TextCodepointsToUTF8(int* codepoints, int length); 1622 1623 // Text strings management functions (no UTF-8 strings, only byte chars) 1624 // NOTE: Some strings allocate memory internally for returned strings, just be careful! 1625 /// Copy one string to another, returns bytes copied 1626 int TextCopy(char* dst, const(char*) src); 1627 /// Check if two text string are equal 1628 bool TextIsEqual(const(char*) text1, const(char*) text2); 1629 /// Get text length, checks for '\0' ending 1630 uint TextLength(const(char*) text); 1631 /// Text formatting with variables (sprintf() style) 1632 const(char*) TextFormat(const(char*) text, ...); 1633 /// Get a piece of a text string 1634 const(char*) TextSubtext(const(char*) text, int position, int length); 1635 /// Replace text string (WARNING: memory must be freed!) 1636 char* TextReplace(char* text, const(char*) replace, const(char*) by); 1637 /// Insert text in a position (WARNING: memory must be freed!) 1638 char* TextInsert(const(char*) text, const(char*) insert, int position); 1639 /// Join text strings with delimiter 1640 const(char*) TextJoin(const(char*)* textList, int count, const(char*) delimiter); 1641 /// Split text into multiple strings 1642 const(char*)* TextSplit(const(char*) text, char delimiter, int* count); 1643 /// Append text at specific position and move cursor! 1644 void TextAppend(char* text, const(char*) append, int* position); 1645 /// Find first text occurrence within a string 1646 int TextFindIndex(const(char*) text, const(char*) find); 1647 /// Get upper case version of provided string 1648 const(char*) TextToUpper(const(char*) text); 1649 /// Get lower case version of provided string 1650 const(char*) TextToLower(const(char*) text); 1651 /// Get Pascal case notation version of provided string 1652 const(char*) TextToPascal(const(char*) text); 1653 /// Get integer value from text (negative values not supported) 1654 int TextToInteger(const(char*) text); 1655 1656 //------------------------------------------------------------------------------------ 1657 // Basic 3d Shapes Drawing Functions (Module: models) 1658 //------------------------------------------------------------------------------------ 1659 1660 // Basic geometric 3D shapes drawing functions 1661 /// Draw a line in 3D world space 1662 void DrawLine3D(Vector3 startPos, Vector3 endPos, Color color); 1663 /// Draw a point in 3D space, actually a small line 1664 void DrawPoint3D(Vector3 position, Color color); 1665 /// Draw a circle in 3D world space 1666 void DrawCircle3D(Vector3 center, float radius, Vector3 rotationAxis, 1667 float rotationAngle, Color color); 1668 /// Draw a color-filled triangle (vertex in counter-clockwise order!) 1669 void DrawTriangle3D(Vector3 v1, Vector3 v2, Vector3 v3, Color color); 1670 /// Draw a triangle strip defined by points 1671 void DrawTriangleStrip3D(Vector3* points, int pointCount, Color color); 1672 /// Draw cube 1673 void DrawCube(Vector3 position, float width, float height, float length, Color color); 1674 /// Draw cube (Vector version) 1675 void DrawCubeV(Vector3 position, Vector3 size, Color color); 1676 /// Draw cube wires 1677 void DrawCubeWires(Vector3 position, float width, float height, float length, Color color); 1678 /// Draw cube wires (Vector version) 1679 void DrawCubeWiresV(Vector3 position, Vector3 size, Color color); 1680 /// Draw cube textured 1681 void DrawCubeTexture(Texture2D texture, Vector3 position, float width, 1682 float height, float length, Color color); 1683 /// Draw cube with a region of a texture 1684 void DrawCubeTextureRec(Texture2D texture, Rectangle source, Vector3 position, 1685 float width, float height, float length, Color color); 1686 /// Draw sphere 1687 void DrawSphere(Vector3 centerPos, float radius, Color color); 1688 /// Draw sphere with extended parameters 1689 void DrawSphereEx(Vector3 centerPos, float radius, int rings, int slices, Color color); 1690 /// Draw sphere wires 1691 void DrawSphereWires(Vector3 centerPos, float radius, int rings, int slices, Color color); 1692 /// Draw a cylinder/cone 1693 void DrawCylinder(Vector3 position, float radiusTop, float radiusBottom, 1694 float height, int slices, Color color); 1695 /// Draw a cylinder with base at startPos and top at endPos 1696 void DrawCylinderEx(Vector3 startPos, Vector3 endPos, float startRadius, 1697 float endRadius, int sides, Color color); 1698 /// Draw a cylinder/cone wires 1699 void DrawCylinderWires(Vector3 position, float radiusTop, float radiusBottom, 1700 float height, int slices, Color color); 1701 /// Draw a cylinder wires with base at startPos and top at endPos 1702 void DrawCylinderWiresEx(Vector3 startPos, Vector3 endPos, float startRadius, 1703 float endRadius, int sides, Color color); 1704 /// Draw a plane XZ 1705 void DrawPlane(Vector3 centerPos, Vector2 size, Color color); 1706 /// Draw a ray line 1707 void DrawRay(Ray ray, Color color); 1708 /// Draw a grid (centered at (0, 0, 0)) 1709 void DrawGrid(int slices, float spacing); 1710 1711 //------------------------------------------------------------------------------------ 1712 // Model 3d Loading and Drawing Functions (Module: models) 1713 //------------------------------------------------------------------------------------ 1714 1715 // Model management functions 1716 /// Load model from files (meshes and materials) 1717 Model LoadModel(const(char*) fileName); 1718 /// Load model from generated mesh (default material) 1719 Model LoadModelFromMesh(Mesh mesh); 1720 /// Unload model (including meshes) from memory (RAM and/or VRAM) 1721 void UnloadModel(Model model); 1722 /// Unload model (but not meshes) from memory (RAM and/or VRAM) 1723 void UnloadModelKeepMeshes(Model model); 1724 /// Compute model bounding box limits (considers all meshes) 1725 BoundingBox GetModelBoundingBox(Model model); 1726 1727 // Model drawing functions 1728 /// Draw a model (with texture if set) 1729 void DrawModel(Model model, Vector3 position, float scale, Color tint); 1730 /// Draw a model with extended parameters 1731 void DrawModelEx(Model model, Vector3 position, Vector3 rotationAxis, 1732 float rotationAngle, Vector3 scale, Color tint); 1733 /// Draw a model wires (with texture if set) 1734 void DrawModelWires(Model model, Vector3 position, float scale, Color tint); 1735 /// Draw a model wires (with texture if set) with extended parameters 1736 void DrawModelWiresEx(Model model, Vector3 position, Vector3 rotationAxis, 1737 float rotationAngle, Vector3 scale, Color tint); 1738 /// Draw bounding box (wires) 1739 void DrawBoundingBox(BoundingBox box, Color color); 1740 /// Draw a billboard texture 1741 void DrawBillboard(Camera camera, Texture2D texture, Vector3 position, float size, Color tint); 1742 /// Draw a billboard texture defined by source 1743 void DrawBillboardRec(Camera camera, Texture2D texture, Rectangle source, 1744 Vector3 position, Vector2 size, Color tint); 1745 /// Draw a billboard texture defined by source and rotation 1746 void DrawBillboardPro(Camera camera, Texture2D texture, Rectangle source, 1747 Vector3 position, Vector3 up, Vector2 size, Vector2 origin, float rotation, Color tint); 1748 1749 // Mesh management functions 1750 /// Upload mesh vertex data in GPU and provide VAO/VBO ids 1751 void UploadMesh(Mesh* mesh, bool dynamic); 1752 /// Update mesh vertex data in GPU for a specific buffer index 1753 void UpdateMeshBuffer(Mesh mesh, int index, void* data, int dataSize, int offset); 1754 /// Unload mesh data from CPU and GPU 1755 void UnloadMesh(Mesh mesh); 1756 /// Draw a 3d mesh with material and transform 1757 void DrawMesh(Mesh mesh, Material material, Matrix transform); 1758 /// Draw multiple mesh instances with material and different transforms 1759 void DrawMeshInstanced(Mesh mesh, Material material, Matrix* transforms, int instances); 1760 /// Export mesh data to file, returns true on success 1761 bool ExportMesh(Mesh mesh, const(char*) fileName); 1762 /// Compute mesh bounding box limits 1763 BoundingBox GetMeshBoundingBox(Mesh mesh); 1764 /// Compute mesh tangents 1765 void GenMeshTangents(Mesh* mesh); 1766 /// Compute mesh binormals 1767 void GenMeshBinormals(Mesh* mesh); 1768 1769 // Mesh generation functions 1770 /// Generate polygonal mesh 1771 Mesh GenMeshPoly(int sides, float radius); 1772 /// Generate plane mesh (with subdivisions) 1773 Mesh GenMeshPlane(float width, float length, int resX, int resZ); 1774 /// Generate cuboid mesh 1775 Mesh GenMeshCube(float width, float height, float length); 1776 /// Generate sphere mesh (standard sphere) 1777 Mesh GenMeshSphere(float radius, int rings, int slices); 1778 /// Generate half-sphere mesh (no bottom cap) 1779 Mesh GenMeshHemiSphere(float radius, int rings, int slices); 1780 /// Generate cylinder mesh 1781 Mesh GenMeshCylinder(float radius, float height, int slices); 1782 /// Generate cone/pyramid mesh 1783 Mesh GenMeshCone(float radius, float height, int slices); 1784 /// Generate torus mesh 1785 Mesh GenMeshTorus(float radius, float size, int radSeg, int sides); 1786 /// Generate trefoil knot mesh 1787 Mesh GenMeshKnot(float radius, float size, int radSeg, int sides); 1788 /// Generate heightmap mesh from image data 1789 Mesh GenMeshHeightmap(Image heightmap, Vector3 size); 1790 /// Generate cubes-based map mesh from image data 1791 Mesh GenMeshCubicmap(Image cubicmap, Vector3 cubeSize); 1792 1793 // Material loading/unloading functions 1794 /// Load materials from model file 1795 Material* LoadMaterials(const(char*) fileName, int* materialCount); 1796 /// Load default material (Supports: DIFFUSE, SPECULAR, NORMAL maps) 1797 Material LoadMaterialDefault(); 1798 /// Unload material from GPU memory (VRAM) 1799 void UnloadMaterial(Material material); 1800 /// Set texture for a material map type (MATERIAL_MAP_DIFFUSE, MATERIAL_MAP_SPECULAR...) 1801 void SetMaterialTexture(Material* material, int mapType, Texture2D texture); 1802 /// Set material for a mesh 1803 void SetModelMeshMaterial(Model* model, int meshId, int materialId); 1804 1805 // Model animations loading/unloading functions 1806 /// Load model animations from file 1807 ModelAnimation* LoadModelAnimations(const(char*) fileName, uint* animCount); 1808 /// Update model animation pose 1809 void UpdateModelAnimation(Model model, ModelAnimation anim, int frame); 1810 /// Unload animation data 1811 void UnloadModelAnimation(ModelAnimation anim); 1812 /// Unload animation array data 1813 void UnloadModelAnimations(ModelAnimation* animations, uint count); 1814 /// Check model animation skeleton match 1815 bool IsModelAnimationValid(Model model, ModelAnimation anim); 1816 1817 // Collision detection functions 1818 /// Check collision between two spheres 1819 bool CheckCollisionSpheres(Vector3 center1, float radius1, Vector3 center2, float radius2); 1820 /// Check collision between two bounding boxes 1821 bool CheckCollisionBoxes(BoundingBox box1, BoundingBox box2); 1822 /// Check collision between box and sphere 1823 bool CheckCollisionBoxSphere(BoundingBox box, Vector3 center, float radius); 1824 /// Get collision info between ray and sphere 1825 RayCollision GetRayCollisionSphere(Ray ray, Vector3 center, float radius); 1826 /// Get collision info between ray and box 1827 RayCollision GetRayCollisionBox(Ray ray, BoundingBox box); 1828 /// Get collision info between ray and model 1829 RayCollision GetRayCollisionModel(Ray ray, Model model); 1830 /// Get collision info between ray and mesh 1831 RayCollision GetRayCollisionMesh(Ray ray, Mesh mesh, Matrix transform); 1832 /// Get collision info between ray and triangle 1833 RayCollision GetRayCollisionTriangle(Ray ray, Vector3 p1, Vector3 p2, Vector3 p3); 1834 /// Get collision info between ray and quad 1835 RayCollision GetRayCollisionQuad(Ray ray, Vector3 p1, Vector3 p2, Vector3 p3, Vector3 p4); 1836 1837 //------------------------------------------------------------------------------------ 1838 // Audio Loading and Playing Functions (Module: audio) 1839 //------------------------------------------------------------------------------------ 1840 1841 // Audio device management functions 1842 /// Initialize audio device and context 1843 void InitAudioDevice(); 1844 /// Close the audio device and context 1845 void CloseAudioDevice(); 1846 /// Check if audio device has been initialized successfully 1847 bool IsAudioDeviceReady(); 1848 /// Set master volume (listener) 1849 void SetMasterVolume(float volume); 1850 1851 // Wave/Sound loading/unloading functions 1852 /// Load wave data from file 1853 Wave LoadWave(const(char*) fileName); 1854 /// Load wave from memory buffer, fileType refers to extension: i.e. '.wav' 1855 Wave LoadWaveFromMemory(const(char*) fileType, const ubyte* fileData, int dataSize); 1856 /// Load sound from file 1857 Sound LoadSound(const(char*) fileName); 1858 /// Load sound from wave data 1859 Sound LoadSoundFromWave(Wave wave); 1860 /// Update sound buffer with new data 1861 void UpdateSound(Sound sound, const void* data, int sampleCount); 1862 /// Unload wave data 1863 void UnloadWave(Wave wave); 1864 /// Unload sound 1865 void UnloadSound(Sound sound); 1866 /// Export wave data to file, returns true on success 1867 bool ExportWave(Wave wave, const(char*) fileName); 1868 /// Export wave sample data to code (.h), returns true on success 1869 bool ExportWaveAsCode(Wave wave, const(char*) fileName); 1870 1871 // Wave/Sound management functions 1872 /// Play a sound 1873 void PlaySound(Sound sound); 1874 /// Stop playing a sound 1875 void StopSound(Sound sound); 1876 /// Pause a sound 1877 void PauseSound(Sound sound); 1878 /// Resume a paused sound 1879 void ResumeSound(Sound sound); 1880 /// Play a sound (using multichannel buffer pool) 1881 void PlaySoundMulti(Sound sound); 1882 /// Stop any sound playing (using multichannel buffer pool) 1883 void StopSoundMulti(); 1884 /// Get number of sounds playing in the multichannel 1885 int GetSoundsPlaying(); 1886 /// Check if a sound is currently playing 1887 bool IsSoundPlaying(Sound sound); 1888 /// Set volume for a sound (1.0 is max level) 1889 void SetSoundVolume(Sound sound, float volume); 1890 /// Set pitch for a sound (1.0 is base level) 1891 void SetSoundPitch(Sound sound, float pitch); 1892 /// Convert wave data to desired format 1893 void WaveFormat(Wave* wave, int sampleRate, int sampleSize, int channels); 1894 /// Copy a wave to a new wave 1895 Wave WaveCopy(Wave wave); 1896 /// Crop a wave to defined samples range 1897 void WaveCrop(Wave* wave, int initSample, int finalSample); 1898 /// Load samples data from wave as a floats array 1899 float* LoadWaveSamples(Wave wave); 1900 /// Unload samples data loaded with LoadWaveSamples() 1901 void UnloadWaveSamples(float* samples); 1902 1903 // Music management functions 1904 /// Load music stream from file 1905 Music LoadMusicStream(const(char*) fileName); 1906 /// Load music stream from data 1907 Music LoadMusicStreamFromMemory(const(char*) fileType, ubyte* data, int dataSize); 1908 /// Unload music stream 1909 void UnloadMusicStream(Music music); 1910 /// Start music playing 1911 void PlayMusicStream(Music music); 1912 /// Check if music is playing 1913 bool IsMusicStreamPlaying(Music music); 1914 /// Updates buffers for music streaming 1915 void UpdateMusicStream(Music music); 1916 /// Stop music playing 1917 void StopMusicStream(Music music); 1918 /// Pause music playing 1919 void PauseMusicStream(Music music); 1920 /// Resume playing paused music 1921 void ResumeMusicStream(Music music); 1922 /// Seek music to a position (in seconds) 1923 void SeekMusicStream(Music music, float position); 1924 /// Set volume for music (1.0 is max level) 1925 void SetMusicVolume(Music music, float volume); 1926 /// Set pitch for a music (1.0 is base level) 1927 void SetMusicPitch(Music music, float pitch); 1928 /// Get music time length (in seconds) 1929 float GetMusicTimeLength(Music music); 1930 /// Get current music time played (in seconds) 1931 float GetMusicTimePlayed(Music music); 1932 1933 // AudioStream management functions 1934 /// Load audio stream (to stream raw audio pcm data) 1935 AudioStream LoadAudioStream(uint sampleRate, uint sampleSize, uint channels); 1936 /// Unload audio stream and free memory 1937 void UnloadAudioStream(AudioStream stream); 1938 /// Update audio stream buffers with data 1939 void UpdateAudioStream(AudioStream stream, const void* data, int frameCount); 1940 /// Check if any audio stream buffers requires refill 1941 bool IsAudioStreamProcessed(AudioStream stream); 1942 /// Play audio stream 1943 void PlayAudioStream(AudioStream stream); 1944 /// Pause audio stream 1945 void PauseAudioStream(AudioStream stream); 1946 /// Resume audio stream 1947 void ResumeAudioStream(AudioStream stream); 1948 /// Check if audio stream is playing 1949 bool IsAudioStreamPlaying(AudioStream stream); 1950 /// Stop audio stream 1951 void StopAudioStream(AudioStream stream); 1952 /// Set volume for audio stream (1.0 is max level) 1953 void SetAudioStreamVolume(AudioStream stream, float volume); 1954 /// Set pitch for audio stream (1.0 is base level) 1955 void SetAudioStreamPitch(AudioStream stream, float pitch); 1956 /// Default size for new audio streams 1957 void SetAudioStreamBufferSizeDefault(int size);